Jump to content

Little Problem! Mysql and PHP Problem! Please Help


paulman888888

Recommended Posts

Simple Question; What have i done wrong again?

Its my little search engine page. Have more than one table the user can search. I have limited the tables the user can see so theres no sercurity problem.

 

Heres the code

// Build SQL Query  
$query = "SELECT * FROM `$search_where` WHERE '$search_name' LIKE \"%$trimmed%\"  ORDER BY id"; // EDIT HERE and specify your table and field names for the SQL query

$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);//this is line 62

Heres the error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/paul/public_html/page/search.php on line 62

EDIT: I have just done another try and i got no errors but i also got no search results. I no theres is some but why am i not getting any?

 

Thankyou all in advance

Paul

It meas that line 61 ($numresults=mysql_query($query);) is does not contain a valid query.  Did you connect to the DB server and select a BD

 

Side Note: There is still a potentail security problem there.

change  LIKE \"%$trimmed%\"  ORD

to

LIKE \"%" . mysql_real_escape_string($trimmed) . "%\"  ORD

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.