mlummus Posted April 20, 2010 Share Posted April 20, 2010 I'm learning PHP and am having an issue I can't seem to figure out this issue. I'm getting the following error on the line: {echo "<option value='freshman' selected = 'selected'>Freshman</option>}";} Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /net/oitg/export/home1/home3/mdl0002/public_html/assignment1/lookupstudent.php on line 58 Any help is much appreciated. Thanks! $SQLstring = "SELECT * FROM student WHERE id = '$id'"; $QueryResult = @mysql_query($SQLstring); $NumRows = mysqli_num_rows($QueryResult); if ($NumRows == 0) echo "<p>No Records Found."; else { $Row = mysql_fetch_arraw($QueryResult); $id = $Row['id']; $name_last = $Row['name_last']; $name_first = $Row['name_first']; $email = $Row['email']; $class = $Row['class']; $major = $Row['major']; $living = $Row['living']; echo "<form action='updatestudent.php' method='get'>"; echo "ID <input type='text' name='id' value=$id/> <br />"; echo "Last Name <input type='text' name='name_last' value=$name_last /> <br /> "; echo "First Name <input type='text' name='name_first' value=$name_first/> <br /> "; echo "Email Address <input type='text' name='email' value=$email/> <br /> "; echo "Classification <select name='class'> if ($class == 'freshman') {echo "<option value='freshman' selected = 'selected'>Freshman</option>}";} else {echo "<option value='freshman'> Freshman </option>";} if ($class == 'sophomore') {echo "<option value='sophomore' selected = 'selected'> Sophomore </option>";} else {echo "<option value='sophomore'> Sophomore </option>";} if ($class == "junior") {echo "<option value='junior' selected = 'selected' Junior </option>";} else {echo "<option value='junior'> Junior </option>";} if ($class == "senior") {echo "<option value='senior' selected = 'selected' Senior </option>";} else {echo "<option value='senior'> Senior </option>";} if ($class == "graduate") {echo "<option value='graduate' selected = 'selected' Graduate </option>";} else {echo "<option value='graduate'> Graduate </option>";} </select> <br />"; <input type="submit"> </form> mysqli_close($db); Link to comment https://forums.phpfreaks.com/topic/199162-help-parse-error-syntax-error-unexpected-t_string-expecting-or/ Share on other sites More sharing options...
Ken2k7 Posted April 20, 2010 Share Posted April 20, 2010 echo "Classification <select name='class'> ^ that line, you forgot to close a quote and add a semi-colon. Link to comment https://forums.phpfreaks.com/topic/199162-help-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1045315 Share on other sites More sharing options...
mlummus Posted April 20, 2010 Author Share Posted April 20, 2010 Thanks Ken. Of course it was something blatantly obvious - been staring at it too long I guess! Link to comment https://forums.phpfreaks.com/topic/199162-help-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1045319 Share on other sites More sharing options...
NTSmarkv Posted April 20, 2010 Share Posted April 20, 2010 {echo "<option value='freshman' selected = 'selected'>Freshman</option>}";} to this: { echo "<option value='freshman' selected = 'selected'>Freshman</option>"; } Link to comment https://forums.phpfreaks.com/topic/199162-help-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1045322 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.