help with entering info into mysql database
Posted: Thu Apr 02, 2009 8:53 am
I am very new to all of this but man I am having fun with it. In advanced thanks for your help.
I have the below code in a file. I am not sure why it is not working. The connection is working. When I run it I get a result echoed "Entered" but the information is not in the database?
I have the below code in a file. I am not sure why it is not working. The connection is working. When I run it I get a result echoed "Entered" but the information is not in the database?
Code: Select all
<?php
include('dbconnection.php');
//insert into users table
$name="test";
$email="testemail@test.com";
$password="test123";
$sql2="INSERT INTO users SET username='$name', email='$email', password='$password'";
$result2=mysql_query(sql2);
if($sql2){
echo"Entered";
}else{
echo"failed";
}
?>