sanderphp Posted May 18, 2008 Share Posted May 18, 2008 I'm getting a "Parse error: syntax error, unexpected T_STRING in /home/sanderan/public_html/php/cycling/singlerecord.php on line 25" error on the echo ('results[0] line. I had this working before but not sure what I changed. if(count($results)){ echo('.$results[0]['id'].' '.$results[0]['date'].' '.$results[0]['total_distance'] '.$results[0]['total_time'] '.$results[0]['ave_speed'].'); }else{ echo('Sorry - no result found'); } Link to comment https://forums.phpfreaks.com/topic/106233-solved-what-is-wrong-with-this-code/ Share on other sites More sharing options...
Gamic Posted May 18, 2008 Share Posted May 18, 2008 <?php if(count($results)){ echo('.$results[0]['id'].' '.$results[0]['date'].' '.$results[0]['total_distance'] '.$results[0]['total_time'] '.$results[0]['ave_speed'].'); }else{ echo('Sorry - no result found'); } ?> to <?php if(count($results)){ $sp=" "; echo($results[0]['id'] .$sp. $results[0]['date'].$sp.$results[0]['total_distance'].$sp.$results[0]['total_time'].$sp.$results[0]['ave_speed']}.$sp); }else{ echo('Sorry - no result found'); } ?> (the colour coding here will, hopefully, help you see what you did wrong in the first case). Link to comment https://forums.phpfreaks.com/topic/106233-solved-what-is-wrong-with-this-code/#findComment-544493 Share on other sites More sharing options...
sanderphp Posted May 18, 2008 Author Share Posted May 18, 2008 thanks. You had an extra } in the end in your line, but I took that out and it worked perfetly. Thanks again Link to comment https://forums.phpfreaks.com/topic/106233-solved-what-is-wrong-with-this-code/#findComment-544500 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.