GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 11-Sep-2008, 00:07
tripsman tripsman is offline
New Member
 
Join Date: Sep 2008
Posts: 3
tripsman is on a distinguished road
Question

Parse error: syntax error, unexpected T_STRING


I cant seem to get pass this error:

Parse error: syntax error, unexpected T_STRING

here is the code
PHP Code:

<?php

// Make a MySQL Connection
$query = "SELECT id,vnames,mem from victims " ;     

$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result)){
    
    print"<li><a href=\"count.php?file=thanks.htm&amp;tag=".$row['id']."\">". $row['vnames']."</a><br> [color="DarkRed"]'$tag=".$row['id']."'; include "countn.php"[/color]</li>";    
    }
 
?>


the red part is causing the trouble.
Last edited by LuciWiz : 11-Sep-2008 at 00:51. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 11-Sep-2008, 07:59
tripsman tripsman is offline
New Member
 
Join Date: Sep 2008
Posts: 3
tripsman is on a distinguished road

Re: Need help with this code:Please


Didn't expect the whole code to be in color. Here is the code again

PHP Code:

<?php

// Make a MySQL Connection
$query = "SELECT id,vnames,mem from victims " ;     

$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result)){
    
    print"<li><a href=\"count.php?file=thanks.htm&amp;tag=".$row['id']."\">". $row['vnames']."</a><br> '$tag=".$row['id']."'; include "countn.php"</li>";    
    }
 
?>

Last edited by admin : 11-Sep-2008 at 21:13. Reason: Please insert your example PHP codes between [PHP] and [/PHP] tags
  #3  
Old 11-Sep-2008, 08:17
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Need help with this code:Please


I find that it sometimes helps to break up the concatenation to see what might be wrong:
ORIGINAL:
PHP Code:

print "<li><a href=\"count.php?file=thanks.htm&amp;tag=".  //ok
    $row['id'] .     //ok
    "\">" .   //ok
    $row['vnames'] . //ok
    "</a><br> '$tag=" .   //ok
    $row['id'] . //ok
    "'; include "countn.php"</li>";  // oops! highlighting break at the inner quotes 


MODIFIED
PHP Code:

print "<li><a href=\"count.php?file=thanks.htm&amp;tag=". 
    $row['id'] . 
    "\">" . 
    $row['vnames'] .
    "</a><br> '$tag=" .
    $row['id'] . 
    "'; include \"countn.php\"</li>";  // escaped quotes. 


If there is still a parse complaint, post another reply.

Of course, once the concat is good, then 'unwind' the lines.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #4  
Old 11-Sep-2008, 17:19
tripsman tripsman is offline
New Member
 
Join Date: Sep 2008
Posts: 3
tripsman is on a distinguished road

Re: Need help with this code:Please


i dont get the error but: =$row['id'] . "'; include \"countn.php\ shows up literally and not the data it holds
  #5  
Old 12-Sep-2008, 04:57
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Parse error: syntax error, unexpected T_STRING


Then it is not clear to me what the goal may be. Do you want the include contents to be added INside the <li> tag?
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:04.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.