DataSpy Posted February 9, 2007 Share Posted February 9, 2007 <?php if ($order == "etitle") { $ordername = English Name;} <=== line 102 elseif ($order == "type") { $ordername = Type;} else ($order == "entered") { $ordername = Date Entered;} ?> and the error I get is "Parse error: parse error, unexpected T_STRING in C:\Program Files\xampp\htdocs\xampp\www\test\anime2.php on line 102" Thanx in advance any help would be greatly appretiated! Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/ Share on other sites More sharing options...
fert Posted February 9, 2007 Share Posted February 9, 2007 you need to put the strings in quotes Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/#findComment-180355 Share on other sites More sharing options...
hvle Posted February 9, 2007 Share Posted February 9, 2007 $ordername = 'English Name'; Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/#findComment-180357 Share on other sites More sharing options...
DataSpy Posted February 9, 2007 Author Share Posted February 9, 2007 <?php if ($order == "etitle") { $ordername = 'English Name';} elseif ($order == "type") { $ordername = 'Type';} else ($order == "entered") { <=== line 105 $ordername = 'Date Entered';} ?> Now it says "Parse error: parse error, unexpected '{' in C:\Program Files\xampp\htdocs\xampp\www\test\anime2.php on line 105". Will the errors ever stop :'( Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/#findComment-180463 Share on other sites More sharing options...
hvle Posted February 9, 2007 Share Posted February 9, 2007 yes eventually, if you learn to write correct code. else ($order == "entered") { change to else { Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/#findComment-180468 Share on other sites More sharing options...
kenrbnsn Posted February 9, 2007 Share Posted February 9, 2007 You can also use a switch statement here: <?php switch ($order) { case 'etitle': $ordername = 'English Title'; break; case 'type': $ordername = 'Type'; break; case 'entered': $ordername = 'Date Entered'; break; default: $ordername = 'Unknown'; } ?> Ken Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/#findComment-180498 Share on other sites More sharing options...
DataSpy Posted February 9, 2007 Author Share Posted February 9, 2007 Thanx for everyones help Sorry I'm so retarded I haven't written php in like a year and wasn't really good start with Link to comment https://forums.phpfreaks.com/topic/37706-elseif-parse-error/#findComment-180501 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.