So i have this html file that is basicly a form. The form calls a PHP that should in theory access the mysql db but it doesn't. well. it kind of does..
Let me start with the code.. the WEBSITE is plane html with a bunch of "input names" for the fields. these are the same names as in the database..
i.e <input name="fname" size=30>
firstname ;P
so anyways..
<FORM METHOD="POST" ACTION="addinfo.php">
<INPUT type="submit">
so when i press submit, it runs the phpscript..
i have LOTS of notes in my php script so i can see where it is failing...
$DBhost = "myhost.isp.com";
$DBuser = "username";
$DBpass = "password";
$DBName = "testing";
$table = "data";
print "Connecting to Database...";
print "<p>";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
print "Connected to Database - Sending data...";
print "<p>";
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "INSERT INTO $table VALUES('','$fname','$lname','$address','$city','$state','$zip','$hphone','$wphone')";
print "Data Sent!";
print "<p>";
print "Closing Database";
$results = mysql_query($sqlquery);
mysql_close();
print "<p>";
print "Database closed!.. Wait for result..";
print "<p>";
print "File: $fname, $lname ";
print "was added to the database";
?>
and i get the result..
Connecting to Database...
Connected to Database - Sending data...
Data Sent!
Closing Database
Database closed!.. Wait for result..
File: hihi, john was added to the database
but my mysql database has no records.. if i break part of it i.e host, pass, etc.. i get errors, even if i break the table or db name.. so its connecting.. also i see it connected.
all of the $lname etc matches exactly whats in the database... minus the $ of course.. i.e "$lname" matches "lname" in the database..
what am i missing?
it connects to the database, just doens't add the line..