Re: MySQL error, what's wrong here..

From: Date: Mon, 23 Jul 2001 23:38:31 +0000
Subject: Re: MySQL error, what's wrong here..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59277@lists.php.net to get a copy of this message
alright, new problem, no more errors, but there's just nothing...here's the code: <?php $id = rand(1,2); $query = "SELECT name FROM mp3 WHERE songid = '" .$id."'"; $result = mysql_query($query,$connection); while($mp3d = mysql_fetch_array($result)) { $mp3d = mysql_fetch_array($result); ?> <a href="http://www.fplg.net/stream.php?songid=<?php echo $id;?>" class="hov1"><?php echo $mp3d["name"];?></a> <?php } ?> </td> </tr> and here's what the HTML code looks like from the page when i test it out.. <a href="http://www.fplg.net/stream.php?songid=2" class="hov1"></a> what's going on with that... chris ----- Original Message ----- From: James Bogosian <bogosj@rpi.edu> To: Chris Cocuzzo <cuzo@mediaone.net>; <php-general@lists.php.net> Sent: Monday, July 23, 2001 7:25 PM Subject: RE: [PHP]MySQL error, what's wrong here.. > Try: > > $query = "SELECT songname FROM mp3 WHERE sgid = '" .$id."'"; > > an SQL query requires you to quote strings. > > james > > -----Original Message----- > From: Chris Cocuzzo [mailto:cuzo@mediaone.net] > Sent: Monday, July 23, 2001 6:57 PM > To: php-general@lists.php.net > Subject: [PHP]MySQL error, what's wrong here.. > > > <?php > $id = rand(1,2); > $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; > $result = mysql_query($query,$connection); > $mp3d = mysql_fetch_array($result); > ?> > > the server is telling me line 43(which starts with $mp3d) is not a valid > mysql result resource. what am i doing wrong?? > > chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#59277) next »