mysql_fetch_array

Fixed and closed topics
Locked
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

mysql_fetch_array

Post by wp180 »

Hello.

If a user or myself edit the genre, everytime a error is coming:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/htdocs/netjukebox/index.php on line 653


regards
Michael
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

I can't reproduce the error with netjukebox 4.03.
And there is no query on line 653.

Did you use the latest version of netjukebox?
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

Post by wp180 »

Yes, i'm using the 4.03.
But at the moment i see that in the original index.php the error will be in line 652, because i insered one line at the start of the file and some at the end.

If you want i can send you the link to my netjukebox via email.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Please send me the link, than I can check if there is send unexpected post data.

Do you also get the error message when using an unmodified index.php and genre.php script?
Or maybe you could send me the modified index.php script?
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

Post by wp180 »

I also get the error with the original file.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

I have now tested it on two different setups, and can't reproduce the problem:

Apache 2.0.59
PHP 4.4.7
MySQL 4.0.27

Apache 2.2
PHP 5.1.6
MySQL 5.0.25a

Do you have a completed other setup?
Do you always get the error when pressing save in "Select genre"?
Did you have the problem in previous versions of netjukebox?
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Thanks for the test account.
I don't see any problem with changing a genre.
In what situation did you get the error?
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

Post by wp180 »

On my linux system there is running:

Apache 2.0.59
PHP 5.1.6
MySQL 5.0.41

I don't have another setup.
I always get the error. Every time.
And i didn't have the problem in previous versions.

But i didn't install 4.02. I did the update directly from 4.01 to 4.03.
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

Post by wp180 »

wbartels wrote:Thanks for the test account.
I don't see any problem with changing a genre.
In what situation did you get the error?

You don't see any problems? mmh. I tried it again, and i get the error every time.

I go for example to (a), take the first artist, click the box and then edit. after saving i get the error.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

I don't understand it.
With your test account I have changed all album from "die toten hosen" from "punk deutch" to "ska" without any problem.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

wp180 wrote:
wbartels wrote:Thanks for the test account.
I don't see any problem with changing a genre.
In what situation did you get the error?

You don't see any problems? mmh. I tried it again, and i get the error every time.

I go for example to (a), take the first artist, click the box and then edit. after saving i get the error.
Also changed "a+p" "links-rechts" to "ska" without any problem.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Now I can reproduce it.
It only happens when edeting with Firefox.
Also on my own system.
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

Post by wp180 »

I tried it with the internet explorer at the moment. There it is no problem. :-)
But i know that under Mac with Safari there is the problem too.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

I found the problem, In JavaScript location you may not escape & in &

To fix it change code block 156-161 in genre.php from:

Code: Select all

$url = 'index.php?action=view2';
$url.= ($artist == '') ? '&genre_id=' . rawurlencode($genre_id) : '&artist=' . rawurlencode($artist);
$url.= '&order=' . rawurlencode($order);
$url.= '&sort=' . rawurlencode($sort);
echo '<script type="text/javascript">window.location="' . $url . '";</script>';
exit();
to:

Code: Select all

$url = 'index.php?action=view2';
$url.= ($artist == '') ? '&genre_id=' . rawurlencode($genre_id) : '&artist=' . rawurlencode($artist);
$url.= '&order=' . rawurlencode($order);
$url.= '&sort=' . rawurlencode($sort);
echo '<script type="text/javascript">window.location="' . $url . '";</script>';
exit();
I will come up shortly with a fixed version of netjukebox.
wp180
User
Posts: 23
Joined: Tue Jan 16, 2007 11:50 pm
Location: Germany

Post by wp180 »

I tested it. It works very good. :-) Also under Mac Safari.

Thanks for helping.

Micha
Locked