Jump to content


Photo

PHP Syntax Error


  • Please log in to reply
3 replies to this topic

#1 anonymousbob

anonymousbob
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 May 2006 - 07:54 AM

I am using Dreamweaver to build a mySQL-PHP website. An update record page with two dynamic menus is not functioning - it shows the error:

Parse error: syntax error, unexpected T_BAD_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING in [i][!--coloro:#666666--][span style=\"color:#666666\"][!--/coloro--]updatepage[[!--colorc--][/span][!--/colorc--]/i].php on line 218

Recordset info:
rsVoter: calling record to be updated
rsPrecincts: calls dynamic menu #1's info

line 218 reads:

<option value="<?php echo $row_rsPrecincts['votingprecinct_id']?>"<?php if (!(strcmp($row_rsPrecincts['votingprecinct_id'], "$row_rsVoter[\'votingprecinct_id\']"))) {echo "SELECTED";} ?>><?php echo $row_rsPrecincts['precinctname']?></option>

and it is followed on the next line by:

<?php
} while ($row_rsPrecincts = mysql_fetch_assoc($rsPrecincts));
$rows = mysql_num_rows($rsPrecincts);
if($rows > 0) {
mysql_data_seek($rsPrecincts, 0);
$row_rsPrecincts = mysql_fetch_assoc($rsPrecincts);
}
?>

Is there a glaring syntax error on line 218 that my untrained eye has missed?


#2 Honoré

Honoré
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts
  • LocationAntwerp - Belgium

Posted 30 May 2006 - 08:14 AM

try this one:
<option value="<?php echo $row_rsPrecincts['votingprecinct_id']?>"<?php if (!(strcmp($row_rsPrecincts['votingprecinct_id'], $row_rsVoter['votingprecinct_id']))) {echo "SELECTED";} ?>><?php echo $row_rsPrecincts['precinctname']?></option>


#3 anonymousbob

anonymousbob
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 May 2006 - 08:26 AM

Thanks, Honoré, that did the trick! [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

#4 etoper

etoper
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 20 June 2006 - 05:32 PM

[!--quoteo(post=378330:date=May 30 2006, 04:14 AM:name=Honoré)--][div class=\'quotetop\']QUOTE(Honoré @ May 30 2006, 04:14 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
try this one:
<option value="<?php echo $row_rsPrecincts['votingprecinct_id']?>"<?php if (!(strcmp($row_rsPrecincts['votingprecinct_id'], $row_rsVoter['votingprecinct_id']))) {echo "SELECTED";} ?>><?php echo $row_rsPrecincts['precinctname']?></option>
[/quote]

Hi, I'm a little new to PHP, not so much dreamweaver, and i was wondering, how did you know that, that was the mistake? can you please explain more about it.. thanks..

[!--coloro:#FF6600--][span style="color:#FF6600"][!--/coloro--][div align="center"]The EC man![/div][!--colorc--][/span][!--/colorc--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users