472,973 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 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 2620
Dormilich
8,658 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!

regards
Nov 11 '08 #2
nathj
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()); 
  2.  
I have brought the variable inside the string.

Cheers
nathj
Nov 11 '08 #3
Markus
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.

Moderator.
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
Dormilich
8,658 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

*sigh*

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

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

Similar topics

4
by: bovanshi | last post by:
got this annoying error I'm completly new to php... and i have no clue what is wrong here, from what i can tell there is nothing rong with this code... but that isn't what the borwser say :P ...
1
by: mdouble | last post by:
I'm a complete novice with HTML and PHP. Recently I purchased an auto responder that requires me to edit a PHP file during the installation process as per directions provided in a read me file. ...
3
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the...
4
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost",...
5
praclarush
by: praclarush | last post by:
I've just started php, and this is a class assignment, but my question is I’m getting this error PHP Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in...
7
by: ashraf02 | last post by:
i have check the code thoroughly to find the error i am still getting the following error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Catalogue.php on line 23 <!DOCTYPE html...
5
by: sravani2 | last post by:
Hi, i used the below sentence echo "<td><a href=<?=$row?>>".$row."</a></td>"; In that i got the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING...
2
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
5
by: stanman | last post by:
I have been trying to get past this error all day. I am unable to determine why I get syntax error from the following code: //modify a record $myDataID = mysql_query("UPDATE members SET...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.