Fwd: Re: [PHP-DB] I think the code looks fine... my server doesnt agree

From: Date: Mon, 09 Jul 2001 05:48:58 +0000
Subject: Fwd: Re: [PHP-DB] I think the code looks fine... my server doesnt agree
Groups: php.db 
Request: Send a blank email to php-db+get-10170@lists.php.net to get a copy of this message
the problem is that your query is not returning a result i would start by changing
        "$Link = mysql_connect ($Host, $User, $Password);"
AND
        "$Result = mysql_db_query ($DBName, $Query, $Link);"
To
        "$Link = mysql_connect ($Host, $User, $Password) OR die("could not connect");"
AND
        "$Result = mysql_db_query ($DBName, $Query, $Link) OR die("could query");"
i would also echo the variables $Host, $User, $Password, $DBName, $Query, $Link and check they contain what you expect hope that helps
                nick
I think that the following code looks fine, but I get an error (Warning: Supplied argument is not a valid MySQL result resource) where it says "while ($Row = mysql_fetch_array ($Result)) {" any ideas? <?php $Link = mysql_connect ($Host, $User, $Password); $title = trim($title); $title2 = ereg_replace (" ", " %' || like '% ", $title); if ($category) { $Query = "SELECT * from $TableName WHERE ((category)=$category)"; print "Your search query of <b> $category </b> returned the following results:<br><br>"; } else { if ($title) { $Query = "SELECT * from $TableName WHERE title LIKE '%$title2%' "; print "Your search query of <b> $title </b> returned the following results:<br><br>"; } } if ($category = "") { print ""; } $Result = mysql_db_query ($DBName, $Query, $Link); while ($Row = mysql_fetch_array ($Result)) { print "<a href=item.php?p=$Row[id]>"; echo ( $Row[title] ); print "</a><br>"; } mysql_close ($Link); ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
Documenta - Multimedia and Electronic Publishing Services **************************************************************************** The information contained in this e-mail is confidential and is intended solely for the addressee. If you received this e-mail by mistake please promptly inform us by reply e-mail or by telephoning + 61 2 9358 6199 and then delete the e-mail and destroy any printed copy. You must not disclose or use in any way the information in the e-mail. ****************************************************************************
Documenta - Multimedia and Electronic Publishing Services **************************************************************************** The information contained in this e-mail is confidential and is intended solely for the addressee. If you received this e-mail by mistake please promptly inform us by reply e-mail or by telephoning + 61 2 9358 6199 and then delete the e-mail and destroy any printed copy. You must not disclose or use in any way the information in the e-mail. ****************************************************************************

« previous php.db (#10170) next »