<?php
$hostname = "10.18.1.78"; // Usually localhost.
$username = "root"; // If you have no username, leave this space empty.
$usertable = "ipa"; // This is the table you made.
$dbName = "ipadd"; // This is the main database you connect to.
mysql_connect($hostname, $username) or die("Unable to connect to database");
@mysql_select_db( $dbName) or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX = "No Record Found";
$query = mysql_query("SELECT * FROM ipa WHERE $searchList LIKE '%$frm_search%' limit 0, 30");
if ($row = mysql_fetch_array($query))
{
echo "<table border=1>\n";
echo "<tr><td>Owner</td><td>Section</td><td>IP Address</td></tr>\n";
do {
printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n", $row["owner"], $row["section"], $row["ipaddress"]);
} while ($row = mysql_fetch_array($query));
echo "</table>\n";
}
if (!$variable1)
{
print ("$XX");
}
?>
but it has this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\apache\apache2\htdocs\TMP9qjlrwi7z2.php on line 14
No Record Found
thanks for your reply but i still can't get it..
when i change the code above..it prompt out error like:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE '%%'' at line 1
NEVER MIND!! i could kiss you, im just learning php mysql dah dah, geez i been trying to query a search and rahh you just saved me from havign to turn the kettle on for the 5th time this morn haha, MWAHH,