Newbie Help (updating mysql w/php)
Hello friendly people,
To start off I am a brand new beginner to database. I have been reading a book and trying to just pick up on a few things from tutorials and such.
What I want to do is insert data into a database using a web form. I have been looking at some tutorials for example:
http://www.w3schools.com/php/php_mysql_insert.asp
But lets say I have a table called GYMINFO inside that table I have columns for GYMID, GYMNAME, ADDRESS1, CITY, STATE, ZIP, PHONE, FAX, ADDRESS2
But in my webform I only want to collect GYMNAME and PHONE
Below is part of my code but it does not seem that it is adding any data into the database... any help would be appreciated .... Thanks!
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
mysql_select_db("gyms", $dbhandle);
$sql="INSERT INTO GYMINFO (GYMNAME, PHONE)
VALUES ('$_POST[Gname]','$_POST[Gnum]')";
mysql_close($dbhandle);
?>