supplied arguement is not valid

Hello, i am trying to add a mysql query to read a database from searching a certain term for an id and item name but i seem to get this error.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/rstop/public_html/search.php on line 19

Here is my PHP code and i know it is probably injectable but i would like to atleast get my script working first.

[php]<?php
if (!$_POST) {
include(‘database.php’);
} else {
?>

RSTopList ItemDB


<?php $search = $_POST["search"]; MySQL_connect("localhost", "rstop_databases", "r00t3dn0w"); MySQL_select_db("rstop_data"); $result = mysql_query("SELECT * FROM item WHERE name LIKE '%" . mysql_real_escape_string($search) . "%'");

while($row = mysql_fetch_assoc($result))
{
?>

<? echo ''; echo ''; echo ''; echo ''; } } ?>
'.$row['id'] . '' . $row['name'] . '
[/php]

If anyone could help me here i’d really appreciate it.

Kind Regards,
Diesel

You are most likely getting a false result. Add error reporting:

[php]$result = mysql_query(“SELECT * FROM item WHERE name LIKE '%” . mysql_real_escape_string($search) . “%’”)or die(mysql_error());[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service