I'm learning php and I'm having trouble inserting into a MySQL database (for testing purposes). I run the code below and I'm not faced with an error, however the records are not visible in my tables; It's like I anything never happened in the db. Please help, code below:
<?php
//Variable - Declaring the connection
$con=mysql_connect('localhost','joe','12345678')
or die(mysql_error());
//selecting the database
mysql_select_db('users',$con);
//Variable - Declare SQL statement to insert
$sql="INSERT INTO users (name,lastname) VALUES('carl','')";
mysql_query($sql,$con);
?>
The database details are:
server : localhost
user : joe (full permissions)
password : 12345678
database name : test
table name : users
field names : name and lastname\
Help is highly appreciated.
Thanks in advance.
Regards,
Joseph
mysql_query(), and if it'sfalselook atmysql_errorfor the error message.