Jump to content

Which line is it ? (In MySQL error message number 1064)


roparzhhemon237

Recommended Posts

 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 :

 

error_message.png


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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.