Ok Im new at php mysql programimg from scratch. Been reading some tutorials. I have only found one issue on several tutorials. I setup a database. It has fields and values. When I search the database with
$query = mysql_query(“SELECT * FROM details WHERE name=‘john doe’”);
The results.php script works nd returns the data. When I use a search form to try to populate this
$query = mysql_query(“SELECT * FROM details WHERE name=’$search’”);
It comes back no records. I had another form it gave me the same issue
Here are the scripts.
search.htm
<? $username="xxxxxxx"; $password="xxxxxx"; $database="devgrou1_gtaddress"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM contacts WHERE first='$searchfirst'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "Database Output"; ?>
Name | Phone | Mobile | Fax | Website | |
---|---|---|---|---|---|
<? echo "$first $last"; ?> | <? echo "$phone"; ?> | <? echo "$mobile"; ?> | <? echo "$fax"; ?> | ">Website |
?>
Results.php
id | name | telephone | birthday |
<? $hostname = "localhost"; // Our DB server.
$username="xxxxxxx";
$password="xxxxxx";
$usertable = "details"; // The name of the table you made.
$dbName = "devgrou1_gtaddress"; // This is the name of the database you made.
MYSQL_CONNECT($hostname, $username, $password) OR DIE(“DB connection unavailable”); |
|||
$variable1 | "); print ("$variable2 | "); print ("$variable3 | "); print ("$variable4 | "); print ("
Please help. here is the url of the test site name john doe should work
http://dev3.curtiswallis.com/test2/search2.htm
http://dev3.curtiswallis.com/test2/results2.php
Curt