i have made a script that adds to a tabel in mysql, one problem is, even though it echos that it worked. it doesnt add them :(

$dbhost = 'localhost';
$dbuser = 'tezzana_cams';
$dbpass = '**********';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
echo ("Connected...");
$dbname = 'tezzana_camera';
echo ("Selected...");
mysql_query("INSERT INTO `camera` (`id`, `name`, `type`, `link`) VALUES (' ', 'noob cam 2', 'webcam', 'www.alinktothecam.com');");
echo ("Added...");
echo ("Closed.");

There are a couple issues here:

  1. You don't need to put single-quotes around the table name or the field names. Most table formats do not allow empty id fields. If you want it to autofill the number and you have the table set up to do so, just omit the id field from the query. It should look like this:
    INSERT INTO camera (name, type, link) VALUES ('noob cam 2', 'webcam', 'www.alinktothecam.com');
  2. Your program doesn't do any checking to see if the query actually works, it just prints "Added...". So of course it's going to tell you that it worked every time, you told it to.