473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

whats wrong with my update query it resets date to 0000/00/00

29
hi i'm trying to update my data from my database but it keeps reset the date back to 0000/00/00

and now it says error

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 ' DATE_FORMAT(news_date, '%Y/%m/%d') as new_date FROM news SET new_date='', subj' at line 1

this what i got help please

Expand|Select|Wrap|Line Numbers
  1. $query = "UPDATE, DATE_FORMAT(news_date, '%Y/%m/%d') as new_date FROM news SET new_date='$new_date',  subject='$subject', news_artical='$news_artical' WHERE news_id = '$news_id'";
  2.  
Sep 8 '10 #1
4 1146
code green
1,726 Expert 1GB
UPDATE syntax is
Expand|Select|Wrap|Line Numbers
  1. UPDATE tablename SET field = newvalue
Sep 9 '10 #2
lisa007
29
if u mean like this it sets the date back into 0000/00/00
Expand|Select|Wrap|Line Numbers
  1.  $query = "UPDATE news SET news_date='$news_date', subject='$subject', news_artical='$news_artical' WHERE news_id = '$news_id'"; 
Sep 9 '10 #3
code green
1,726 Expert 1GB
Check the value of $news_date
Sep 9 '10 #4
Canabeez
126 100+
I would also suggest to always use addslashes()
Sep 9 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: gondor | last post by:
hi! i have a problem with a update-query: start-structur (column 1 index, 2 datetime, 3 time of measurement, 4-6 values): 1 | 0000-00-00 00:00:00 | 0 | 21 | 22 | 23 2 | 0000-00-00 00:00:00...
2
by: Santosh | last post by:
Hi, I have a script running which fails when it tries to execute an Update query, but when i try to run the query from the SQLQueryAnalyzer it runs fine. Can somebody try and explain this...
3
by: rrh | last post by:
I am trying to update a field in one table with data from another table. The problem I'm running into is I need to base the update on a range of data in the 2nd table. Table 1 has: date field...
2
by: nadmasl | last post by:
I have an MS Access form, where a user enters the date by selecting it from three combo boxes for day, month and year. I convert it to 11-Jan-2004 format and attempt to write to the table with an...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
4
by: jofo | last post by:
Hello all, I have project form and an hours form and related tables for each. The project table has a status flag to determine if the project is open or closed. When a user enters hours on a...
9
by: pandaking | last post by:
Hi there everyone, new here but after reading around it seems like I might hang about - so many helpful threads! I have a slight problem. This flying club near me has employed me to make them a...
3
by: ringer | last post by:
I am trying to add a functionality into a db I use for my checkbook that will help me plan for and save money for future large expenses. Into a table called tblFutureTransactions I want to enter...
1
by: islandgal | last post by:
-- -- Table structure for table borrower -- DROP TABLE IF EXISTS borrower; CREATE TABLE borrower ( brw_num int(11) NOT NULL default '0', brw_lname varchar(15) default NULL, brw_fname...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.