TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 04-10-2008, 09:46 AM   #1 (permalink)
The Wanderer
 
Join Date: Apr 2008
Posts: 12
Thanks: 7
Durux is on a distinguished road
Default Keep getting mySQL error No. 1064, but i can't seem to find the problem

Hello all, i keep geeting the 1064 mySQL error from an sql statement, yet the statement looks valid all the way through.

Here is the PHP script that should update the DB:
PHP Code:
function update($sql$date){
    
    
$link aaa_connect();
    
    
$sql2 str_replace("\n"""$sql);
    
$sql2 str_replace("\'""'"$sql2);
        
    
$result mysql_query($sql2$link);
    if(!
$result){die('Invalid query: '.mysql_error().'<br>Error No: '.mysql_errno());}
        
    
$array[0] = mysql_affected_rows();
        
    
$array[1] = date('l',mktime(0,0,0,substr($date62),substr($date9,2),substr($date,1,4))).' the '.date('j',mktime(0,0,0,substr($date62),substr($date9,2),substr($date,1,4))).'. of '.date('F',mktime(0,0,0,substr($date62),substr($date9,2),substr($date,1,4))).' '.date('Y',mktime(0,0,0,substr($date62),substr($date9,2),substr($date,1,4)));
        
    
mysql_close($link);
        
    return 
$array;
        

and here is the sql statement being given to the function:
Code:
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '7300ba4b247142ae68edc24029638129';
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '132f0d58ef38cd0cd91b56334b702efd';
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '19934c1a89b47724c1e7efe97dd84fcd';
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '3eecd1bf00faa7ebb3ca74bf9fbe379a';
i keep getting this error message back:
Code:
Invalid query: 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 '; UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '132f0d58ef38cd0cd91b5' at line 1
Error No: 1064
Can anyone help me out with this one?

Last edited by Durux : 04-10-2008 at 10:11 AM.
Durux is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:02 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design