Jump to content

Help with error.


w0rdawg

Recommended Posts

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]
<?php

include( "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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.