captnbob Posted January 7, 2010 Share Posted January 7, 2010 I can't seem to figure out what wrong here. I keep getting this error and can't figure out what is wrong. Parse error: syntax error, unexpected T_STRING in /home/captnbob/public_html/www/header.php on line 53 Here is the bit of code from line 50 thru 57 <?php include "myownrecommend.php"; $i = rand(1,count($myownrecommend)); $url=$myownrecommend[$i]['url']; $image=$myownrecommend[$i]['image']; $titre=$myownrecommend[$i]['titre']; include "myownnews/config.php"; ?> Please help, Captnbob Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/ Share on other sites More sharing options...
cags Posted January 7, 2010 Share Posted January 7, 2010 What is the value of $myownrecommend? Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/#findComment-990326 Share on other sites More sharing options...
shlumph Posted January 7, 2010 Share Posted January 7, 2010 Does the error happen randomly? I'm just surprised you don't have this: $i = rand(0,count($myownrecommend) - 1); Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/#findComment-990362 Share on other sites More sharing options...
captnbob Posted January 7, 2010 Author Share Posted January 7, 2010 The value of$myownrecommend is defined in a separate file as: $myownrecommend=array("1" => array What is the value of $myownrecommend? Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/#findComment-990397 Share on other sites More sharing options...
captnbob Posted January 7, 2010 Author Share Posted January 7, 2010 No it does not happen randomly, it happens every time I try and open the file. I tried the code you suggested and got the same results. Thanks for the suggestion, Captnbob Does the error happen randomly? I'm just surprised you don't have this: $i = rand(0,count($myownrecommend) - 1); Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/#findComment-990398 Share on other sites More sharing options...
teamatomic Posted January 7, 2010 Share Posted January 7, 2010 Maybe if you complete the statement $myownrecommend=array("1" => array()); or $myownrecommend=array("1" => array); depending on your meaning HTH Teamtomic Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/#findComment-990402 Share on other sites More sharing options...
cags Posted January 7, 2010 Share Posted January 7, 2010 I'm going to guess the error is much earlier or in the include file. Are you using an editor that supports syntax highlighting? Perhaps you have an unclosed pair of ', or " or even brackets somewhere. $url=$myownrecommend[$i]['url']; Link to comment https://forums.phpfreaks.com/topic/187573-im-new-as-you-may-guess/#findComment-990417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.