471,319 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Syntax error, unexpected t_variable.

hi.i have got a problem.

error message:

Parse error: syntax error, unexpected T_VARIABLE in c:\wamp\www\dynamic2.php on line 12

for the line:

Expand|Select|Wrap|Line Numbers
  1. $result=mysql_query("select company from dynamic where id="$id) or  die(mysql_error()); 
if anyone help me,i will be greatful.
Nov 10 '08 #1
6 2397
8,656 Expert Mod 8TB
syntax error in function argument
[PHP]// either
mysql_query("sql" . $var)
// or
mysql_query("sql $var")[/PHP]
don't forget to sanitize your input!

Nov 11 '08 #2
938 Expert 512MB
1. Try using code tags next time
2. Try changing the code to:
Expand|Select|Wrap|Line Numbers
  1. $result=mysql_query("select company from dynamic where id=$id") or die(mysql_error()); 
I have brought the variable inside the string.

Nov 11 '08 #3
6,050 Expert 4TB
Mushfiq, to date you have named every thread you have started Dynamic Link. This explains nothing of the problem in this thread. We expect you to provide a meaningful title as it helps others who are searching the forum with the same problem.

Please take note of this as I have already warned you for not using code tags (and you have failed to do so again).

Read Posting Guidelines.

Nov 11 '08 #4
change the code to

$result=mysql_query("select company from dynamic where `id`="$id) or die(mysql_error());
Nov 11 '08 #5
8,656 Expert Mod 8TB
@divyac this will result in the same error (for exactly the same reasons) plus the quotation marks are in the wrong place


for some basics on strings read this
Nov 11 '08 #6
6,050 Expert 4TB
To all concerned it's called 'concatenation'.
Nov 11 '08 #7

Post your reply

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

Similar topics

1 post views Thread by mdouble | last post: by
5 posts views Thread by sravani2 | last post: by
5 posts views Thread by stanman | last post: by
reply views Thread by rosydwin | last post: by

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.