Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 3rd Apr 2012, 03:15 PM   #1
HyperActive Warrior
 
Join Date: 2009
Posts: 212
Thanks: 11
Thanked 5 Times in 5 Posts
Default
INSERT INTO mysql
Share on: 
fb share twitter share gplus share more share

Getting this error
"Couldn't Add Note Please See AdminYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('April 3, 2012','','Hello I really Hope I get this to work soon','') W' at line 1"

using this code

PHP Code:
if (isset($_POST['submit'])) {
$message = $_POST['message'];
$date = date("F j, Y");
$id = $_GET['id'];
 
$insert = mysql_query("INSERT INTO `jeffdesj`.`notes` (date,user,message,,) VALUES ('$date','$user','$message','') WHERE client_id=$id") or die ("Couldn't Add Note Please See Admin" . mysql_error());

 if (
$insert) {
 echo 
"<div align='center'><font color='red'>Note Added Successfully Please Refresh</font></div>";
 }
} 
I dunno what I'm missing?? I'm using _GET cause I have appending the id in the link..

solidsoul is offline  
Unread 3rd Apr 2012, 04:34 PM   #2
Warrior Extremist
 
xrampage16's Avatar
 
Join Date: 2012
Location: Orange, CA
Posts: 38
Thanks: 0
Thanked 4 Times in 4 Posts
Default
Re: INSERT INTO mysql
Share on: 
fb share twitter share gplus share more share

$insert = mysql_query("INSERT INTO `jeffdesj`.`notes` (date,user,message,,) VALUES ('$date','$user','$message','') WHERE client_id=$id") or die ("Couldn't Add Note Please See Admin" . mysql_error());

you you don't have to surround
`jeffdesj` with "`". Also, you have two ",,", where you might not need that. If you are inserting a complete row, you might want to try this instead

Also, insert statements don't have "where" clauses. You just insert and it appends it to the last row.

$insert = mysql_query("INSERT INTO jeffdesj.`notes` VALUES ('$date','$user','$message','')");

And see if that works.

Developer and Admin for Komputer King LLC hosting - Offering lightning fast web hosting and Quality Backlink Building
xrampage16 is offline  
Closed Thread


Bookmarks

Tags
insert, mysql


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 10:58 PM.