Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

hello i have some error , i can't see it but members who visit site , tell me there ir an error

$query = mysql_query("
SELECT

m.member_id as member_id,
m.member_group_id as member_group_id,
m.members_display_name as members_display_name,
m.email as email,
m.joined as joined, 
m.member_login_key as member_login_key,
m.msg_count_new as msg_count_new,

p.pp_thumb_photo as pp_thumb_photo,
p.pp_photo_type as pp_photo_type

FROM        ".$forum_prefix."members m
LEFT JOIN   ".$forum_prefix."profile_portal p ON p.pp_member_id = m.member_id

WHERE m.member_id = ".$id."
") or die(mysql_error());

and 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 '' at line 17
share|improve this question
1  
What are the values of $forum_prefix and $id that give rise to this error? – eggyal Sep 3 '12 at 13:56
What does your string concatenated evaluates to ? Can't you write that in a debug file or something ? I highly suspect you have WHERE m.member_id = or a similar problem... – Eregrith Sep 3 '12 at 13:58
what are the possible value of $forum_prefix? – 491243 Sep 3 '12 at 13:58
$forum_prefix and $id work's fine , 17 line are at m.msg_count_new as msg_count_new, – fees Sep 3 '12 at 13:59
2  
I bet: $id is empty – chumkiu Sep 3 '12 at 13:59
show 4 more comments

2 Answers

  • The line 17 is the last line of your query.
  • The only thing in this line is

    WHERE m.member_id = ".$id."
    
  • The message error is ““ (empty string). This is a symptom of a "truncated" query.

So, the error is in your php code because the $id var is not set.

share|improve this answer
$forum_prefix = "table_name";// put table name here.its empty in your code
$id = 2;//put your id here and check
$query = mysql_query("
SELECT

m.member_id as member_id,
m.member_group_id as member_group_id,
m.members_display_name as members_display_name,
m.email as email,
m.joined as joined, 
m.member_login_key as member_login_key,
m.msg_count_new as msg_count_new,

p.pp_thumb_photo as pp_thumb_photo,
p.pp_photo_type as pp_photo_type

FROM        ".$forum_prefix."members m
LEFT JOIN   ".$forum_prefix."profile_portal p ON p.pp_member_id = m.member_id

WHERE m.member_id = ".$id."
") or die(mysql_error());
share|improve this answer
Really? are you sure that's the error? – 491243 Sep 3 '12 at 14:02
don,t think so , that is not a problem – dianuj Sep 3 '12 at 14:03
You forgot a . after table_name. This will evaluate to FROM table_namemembers m and LEFT JOIN table_nameprofile_portal p – Eregrith Sep 3 '12 at 14:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.