I am new to PHP so please bare with me; i have the following code which i have put together using several websites but i can not seem to get it to work.
Even though i am using a value that i know is in the table, it is always bring "No result found".
I am assuming it is something really simple, but i can not see it for love or money!!!!
Thanks in advance
Code:
<?PHP
$TPSNUMBER = $_POST['TPSNum']; // carry the variable from the user input TPSNum
$db = mysql_connect("localhost","Username","Password"); // host / username / password
mysql_select_db("tps",$db);
$sql_result = mysql_query("SELECT `phone1` FROM `tps` WHERE `phone1` = $TPSNUMBER", $db); // query
$result = mysql_query($sql_result);
if ($result) {
while ($array= mysql_fetch_assoc($result)) {
echo "The number was found";
}
} else {
echo "No results found";
}
?>
Even though i am using a value that i know is in the table, it is always bring "No result found".
I am assuming it is something really simple, but i can not see it for love or money!!!!
Thanks in advance