Hmmm new to this... Having trouble inserting stuff to db
Posted: Sun Apr 01, 2007 10:38 am
Ok, well like the title says, I'm new to this. I've been following this tutorial..
http://www.freewebmasterhelp.com/tutorials/phpmysql/3
and I need help, when I go to the thing (http://localhost/insertjohn.php)
nothing shows witch is OK but then when I check the database, nothing has been inserted.
I'm using this
(I took out the username and password)
Is something wrong with the code, or is something wrong with the database?
http://www.freewebmasterhelp.com/tutorials/phpmysql/3
and I need help, when I go to the thing (http://localhost/insertjohn.php)
nothing shows witch is OK but then when I check the database, nothing has been inserted.
I'm using this
Code: Select all
<?
$hostname="localhost";
$username="name";
$password="password";
$database="contacts";
mysql_connect($hostname,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES ('','John','Smith','01234 567890','00112 334455','01234 567891','johnsmith@gowansnet.com','http://www.gowansnet.com')";
?>Is something wrong with the code, or is something wrong with the database?