w0rdawg Posted May 7, 2006 Share Posted May 7, 2006 I don't know what I am doing wrong, but I'm get a "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/place/public_html/view_shout.php on line 9"Here's the code the error is coming from:[code]<?phpinclude( "mysql_info.php" );include( "mysql_connect.php" );$querystring = "SELECT name, email, post FROM shoutboxtut WHERE 1 ORDER BY id DESC LIMIT 10";$query = mysql_query( $querystring );while( $a = mysql_fetch_array( $query, MYSQL_ASSOC ) ) { if( !empty( $a['email'] ) ) { $email_start = "<a href=\"mailto:".$a['email']."\" style=\"font-weight:bold;\">"; $email_end = "</a>"; } else { $email_start = ""; $email_end = ""; }; print "Posted by ".$email_start.$a['name'].$email_end.":<br>"; print stripslashes( $a['post'] )."<BR><HR>";};// table create code:/* CREATE TABLE `shoutboxtut` (`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,`ipa` VARCHAR( 15 ) NOT NULL ,`name` VARCHAR( 255 ) NOT NULL ,`email` VARCHAR( 255 ) ,`post` TEXT NOT NULL ,PRIMARY KEY ( `id` ));*/?>[/code]Can anyone help? Thanks. Link to comment https://forums.phpfreaks.com/topic/9264-help-with-error/ Share on other sites More sharing options...
alpine Posted May 7, 2006 Share Posted May 7, 2006 change[code]$query = mysql_query($querystring);[/code]to[code]$query = mysql_query($querystring) or die(mysql_error());[/code]and it will probably point you in the right direction (WHERE what = 1 ??) Link to comment https://forums.phpfreaks.com/topic/9264-help-with-error/#findComment-34130 Share on other sites More sharing options...
AndyB Posted May 7, 2006 Share Posted May 7, 2006 Probably the query you want is:[code]$querystring = "SELECT name, email, post FROM shoutboxtut ORDER BY id DESC LIMIT 10";[/code] Link to comment https://forums.phpfreaks.com/topic/9264-help-with-error/#findComment-34146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.