Jump to content

Archived

This topic is now archived and is closed to further replies.

anonymousbob

PHP Syntax Error

Recommended Posts

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

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

[b]line 218 reads:[/b]

<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>

[b]and it is followed on the next line by:[/b]

<?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);
}
?>

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

Share this post


Link to post
Share on other sites
try this one:
[code]
<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>
[/code]

Share this post


Link to post
Share on other sites
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\" /]

Share this post


Link to post
Share on other sites
[!--quoteo(post=378330:date=May 30 2006, 04:14 AM:name=Honoré)--][div class=\'quotetop\']QUOTE(Honoré @ May 30 2006, 04:14 AM) [snapback]378330[/snapback][/div][div class=\'quotemain\'][!--quotec--]
try this one:
[code]
<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>
[/code]
[/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..

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.