...

View Full Version : invalid result source



chump2877
06-27-2005, 08:05 PM
Another SQL query issue, probably easy to solve?


$search_term99 = $_POST['search_term99'];


$dbcon = mysql_connect("localhost","username","password");

mysql_select_db("MyDatabase",$dbcon);


$search_term99 = trim($search_term99);


$query = "SELECT * WHERE name LIKE '%". $search_term99."%' OR date LIKE '%". $search_term99."%' OR billing_address LIKE '%". $search_term99."%' OR shipping_address LIKE '%". $search_term99."%' OR pick_up LIKE '%". $search_term99."%' OR email LIKE '%". $search_term99."%' OR phone LIKE '%". $search_term99."%' OR order_info LIKE '%". $search_term99."%' OR invoice_no LIKE '%". $search_term99."%' OR order_completed LIKE '%". $search_term99."%'";
$result = mysql_query($query);


$limit = mysql_num_rows($result);
echo $limit;
die();

This code gives me the following error:


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/mediamogulsweb.com/httpdocs/customer_dbase_search_results.php on line 409

Can't figure out what is wrong with the result source....Can you? If you need more information, i can provide it...

Thanks.

chump2877
06-27-2005, 09:09 PM
jesus, I see the error now...I didn;t specify the name of the database... :rolleyes: ....nevermind

marek_mar
06-27-2005, 09:27 PM
You did.


mysql_select_db("MyDatabase",$dbcon);

chump2877
06-27-2005, 11:34 PM
You're right, it was a typo.....I meant I didn't specify the name of the table:


$query = "SELECT * WHERE name LIKE '%".......

should be


$query = "SELECT * FROM table WHERE name LIKE '%".......

marek_mar
06-27-2005, 11:36 PM
That's a table name. You're selecting data from a table.

chump2877
06-27-2005, 11:38 PM
Yeah i just edited my message to change that, but you're too damn quick on the draw...LOL.... :D

marek_mar
06-28-2005, 12:09 AM
FPS (First Person Shooter) do teach you something :D

chump2877
06-28-2005, 12:13 AM
Fps??



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum