I have been working on a simple script that will allow me to connect to a database and search for a specific item (first name). I have been able to set up the data base and connect to it OK but the result is returning "Query was empty".
My search page is simple:-
<form action="connect.php" method="post">
Input Name
:
<input type="text" name="FirstName"><br>
<br>
<br>
<input type="Submit" value="Check Name">
</form>
My PHP code is:-
$con = mysql_connect ("localhost", "xxx", "xxx") or die ('I cannot connect to the database because: ' . mysql_error());
$selected = mysql_select_db ("xxx")
or die ("Could not select database");
$FirstName=$_POST['Value1'];
// PHP Search Script
mysql_query($query);
$query = "SELECT * from Members WHERE FirstName".$_POST['Value1']."'";
$result = mysql_query($sql,$con)or die (mysql_error());
if (mysql_num_rows($result)==0){
echo "No Match Found";
}else{
while ($row = mysql_fetch_array($result)){
echo "First Name: " .$row['FirstName']." ".$row["Value1"]."<br>";
echo "<br>";
echo "---------------------------------------------------------------------"."<br>";
}
}
mysql_close();
I am running round in circles and could really use someone's help!!!!!


