roparzhhemon237 Posted October 28, 2014 Share Posted October 28, 2014 I’ve just read several manual pages and forum comments on "Error number 1064" but I still don’t understand what’s going on with the problem I'm having now … Also, I'm surprised that the error message mentions two different line numbers (1 and 35). Here is the error message I get : And here are the contents of my "one_more_visit_to_topic.php" file : <?php include("includes/model/database_searches/see_readings.php"); include("includes/model/database_searches/see_watchings.php"); function one_more_visit_to_topic($user_id,$topic_id) { global $db; $request_string='UPDATE forum_topic '. 'SET topic_vu = topic_vu + 1 WHERE topic_id = :topic'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); // Remember that topic has been read by user if(!(see_if_user_has_read_topic($user_id,$topic_id))) { $request_string='INSERT INTO forum_read (fr_topic_id,fr_user_id) '. 'VALUES (:topic,:user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } // If user has already received a warning by mail, // the "alert" value needs to be toggled in the fw_watch table if(see_if_user_has_been_warned($user_id,$topic_id)) { $request_string='UPDATE forum_read SET fw_alert = :alt '. 'WHERE fw_topic_id = :topic AND fw_user_id= :user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $one=(int)1; $query->bindValue(':alt',$one,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } return; } ?> Link to comment https://forums.phpfreaks.com/topic/292114-which-line-is-it-in-mysql-error-message-number-1064/ Share on other sites More sharing options...
boompa Posted October 28, 2014 Share Posted October 28, 2014 $request_string='UPDATE forum_read SET fw_alert = :alt '. 'WHERE fw_topic_id = :topic AND fw_user_id= :user)'; Why is there a ) at the end of that query? Link to comment https://forums.phpfreaks.com/topic/292114-which-line-is-it-in-mysql-error-message-number-1064/#findComment-1495006 Share on other sites More sharing options...
Barand Posted October 28, 2014 Share Posted October 28, 2014 Syntax error...at line 1 refers to line 1 of your SQL query code. If you are one of those people who always stretch out there SQL code on a single line then the error will always be on line 1. OTOH, if you structure you queries to make them more readable eg SELECT col1 , col2 , CONCAT(col3, col4) AS something FROM tablea JOIN tableb USING (somekey) ORDERBY col1 then it would report the syntax error in line 7 in the example able The 35 refers to the line in the php file where the error occurred. Link to comment https://forums.phpfreaks.com/topic/292114-which-line-is-it-in-mysql-error-message-number-1064/#findComment-1495010 Share on other sites More sharing options...
roparzhhemon237 Posted October 28, 2014 Author Share Posted October 28, 2014 $request_string='UPDATE forum_read SET fw_alert = :alt '. 'WHERE fw_topic_id = :topic AND fw_user_id= :user)'; Why is there a ) at the end of that query? Of course, how could I be so blind? Thanks for answering my stupid question. Link to comment https://forums.phpfreaks.com/topic/292114-which-line-is-it-in-mysql-error-message-number-1064/#findComment-1495011 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.