Php: I can select from table but not insert why?

  • Thread starter Thread starter Kevin S
  • Start date Start date
K

Kevin S

Guest
This is my PHP script. It can't be the username because the select statment returns values, so it can't be the connection either. I've tried lots of different ways to write the insert statement, this one is created by click create php in my php admin.


<?php
$con = mysql_connect("localhost","TESTING_michael","password1");
echo "con = ";
echo $con;

if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{

$db = mysql_select_db("TESTING_users", $con);
echo "<P>";
echo "db = ";
echo $db;


$sql = "INSERT INTO `TESTING_users`.`people` (`Name`, `Username`, `Password`, `Comment`) VALUES (\'dfr\', \'df\', \'sdf\', \'df\');";





echo "<P>";
echo "mysql = ";
echo $mysql_query;




$result = mysql_query("SELECT * FROM people");

while($row = mysql_fetch_array($result))
{
echo $row['Name'];
echo "<br />";
}









}
mysql_close($con);
echo "connection closed";
?>

Can anybody see anything that is stopping it inserting to my table?
 
Back
Top