First time using PHP (I’ve always used ASP.net. Feel free to insult me)
I’m curious as to why this code gives me this error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
[code]
<?php $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $srch = $_POST['search']; $tbl = $_POST['rdoselct']; $result = mysql_query("SELECT * FROM 'dbtbl' WHERE 1 AND '%$tbl%' LIKE '%$srch%'",$db); echo "%s | %s,%s,%s |
Here’s the HTML for the form.
[code]
City
State/Province
Country
Screen Name
I’ve managed to write 4 seperate search pages (one for each category I want to search in) and use 4 seperate forms consisting of a text input and a submit button. The only major difference between the two methods is my SQL query. It’s
$result = mysql_query(“SELECT * FROMrather than the one I posted above.dbtbl
WHERE 1 ANDtxt_city
LIKE ‘%$txtcity%’”,$db);
Many thanks to anyone who can point me in the right direction.