MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 19th, 2012, 11:18 AM
tyler_long_sim tyler_long_sim is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 13 tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 h 23 m 4 sec
Reputation Power: 0
Whats worng here?

this error message appears when i run my code in php

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '19:37:36,jhj,jhjh)' at line 1


this is the code for the class:

html Code:
Original - html Code
    <script type="text/javascript">  function changeButton(){     if(document.getElementById("name").value !=""){      $("#button1").text("Send to: "+ document.getElementById("name").value);  }else{      $("#button1").text("Send Message");  } }   </script> </head> <body> <?php if($_GET["op"]=="send_message"){        $to = $_POST["username"];     $from = $_SESSION["valid_user"];     $time_sent = date('Y-m-d H:i:s');     $subject = $_POST["subject"];     $message = $_POST["message"];        include("dbConfig.php");         $enter_mess = "INSERT INTO private_message (to_id,from_id,time_sent,subject,message) VALUES (0,0,$time_sent,$subject,$message)"; //declare in the order variable $result = mysql_query($enter_mess) or die(mysql_error());   //order executes if($result){ echo "message sent!!!<br> </br>";        echo $_POST["message"]."<br> </br>"; }else{echo"error";} }else{  ?> <form action="?op=send_message" id="send_message" method="POST">   <fieldset>   <legend>Message</legend>   Username:<br /> <input name="username" type="text" id="name" onkeyup="changeButton()" size="15" /><br /> Subject:<br /> <input name="subject" type="text" id="subject" size="30" /><br /> Message:<br /> <textarea name="message" cols="50" rows="10" id="message"></textarea> <br />     <button id="button1">Send Message</button>​         </fieldset>    </form>    <script> $('textarea').jqte(); </script> <?php }?>

Reply With Quote
  #2  
Old November 19th, 2012, 11:24 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,375 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 7 h 28 m 13 sec
Reputation Power: 4140
immediately before you do this --
Code:
$result = mysql_query($enter_mess) 

please do this --
Code:
 echo $enter_mess
then, copy/paste the actual sql string here, and we'll show you what's wrong with it
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book

Reply With Quote
  #3  
Old November 19th, 2012, 11:29 AM
tyler_long_sim tyler_long_sim is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 13 tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 h 23 m 4 sec
Reputation Power: 0
this is what came up

INSERT INTO private_message (to_id,from_id,time_sent,subject,message) VALUES (0,0,2012-11-19 17:29:02,jhj,jhjh)

Reply With Quote
  #4  
Old November 19th, 2012, 11:32 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,375 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 7 h 28 m 13 sec
Reputation Power: 4140
there's your problem

datetime strings need to be enclosed in single quotes

also, string strings need to be enclosed in single quotes
Code:
VALUES ( 0 , 0 , '2012-11-19 17:29:02' , 'jhj' , 'jhjh' )

Reply With Quote
  #5  
Old November 19th, 2012, 11:35 AM
tyler_long_sim tyler_long_sim is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 13 tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level)tyler_long_sim User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 h 23 m 4 sec
Reputation Power: 0
thankyou that worked

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Whats worng here?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap