Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Cannot insert data into mysql table via php
  2. $username='****';
  3. $password='****';
  4. $database='test';
  5.  
  6.  
  7.  
  8.     $con= mysql_connect("localhost",$username,$password);
  9.  
  10.      mysql_select_db("test",$con);
  11.  
  12.  
  13.  
  14.  
  15.     mysql_query("INSERT INTO getting (Key, Date, amount, tax, Extra)
  16.     VALUES ('', 'sept 26 2008', '35653', '46', '454')");
  17.        
  18. $res = mysql_query(
  19.     "INSERT INTO getting (`Key`, `Date`, amount, tax, Extra)
  20.     VALUES (NULL, '2008-09-26', 35653, 46, 454)");
  21. if (!$res) {
  22.     die('Invalid query: ' . mysql_error());
  23. } else  {
  24.     // Do here what you need
  25. }
  26.        
  27. mysql_query("INSERT INTO getting (Key, Date, amount, tax, Extra)
  28.     VALUES ('', 'sept 26 2008', '35653', '46', '454')") or die(mysql_error());
  29.        
  30. INSERT INTO getting (Date, amount, tax, Extra)
  31. VALUES ('sept 26 2008', '35653', '46', '454')