Author Topic: Why on earth does this not work?  (Read 1364 times)

0 Members and 1 Guest are viewing this topic.

Offline -Felix-Topic starter

  • Enthusiast
  • Posts: 119
    • View Profile
Why on earth does this not work?
« on: October 07, 2005, 10:18:04 AM »
Hey its me again and stupid questions volume 3....

I dont get any errors, the following code just does not write anything to MySQL.

Code: [Select]
mysql_connect ("localhost", "login", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");


$serialnumber=$_SESSION['Serialnumber'];
$Quality=$_SESSION['Quality'].'; '.$_SESSION['Quality2'];

mysql_query("INSERT INTO Tablename (Serialnumber,ID, Date, Details,Quality,Time,Status,Address) VALUES ($serialnumber,'1',$date,$Details,$Quality,$Time,'Waiting','Address')");


mysql_close();
« Last Edit: October 07, 2005, 10:19:12 AM by -Felix- »

Offline effigy

  • Staff Alumni
  • Freak!
  • *
  • Posts: 7,301
  • Gender: Male
  • We must be the change we wish to see in the world.
    • View Profile
Why on earth does this not work?
« Reply #1 on: October 07, 2005, 02:41:35 PM »
you should also use or die on your query statement. you are using a reserved keyword (date) as a column name. change it or surround them with backticks: ``.
« Last Edit: October 07, 2005, 02:42:15 PM by effigy »
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/