violentj Posted March 28, 2008 Share Posted March 28, 2008 Hi ive recently started to learn PHP and have got stuck this is the error i get; Parse error: syntax error, unexpected T_STRING, expecting '}' in /www/110mb.com/v/i/o/l/e/n/t/j/violentj/htdocs/setup.php on line 45 The Code i am using is; ]<? //Good ol' time $time=time(); //////PRETTY SIMPLE, MAKE SURE URL LOCATIONS END WITH "/" $site[location] = 'http://violentj.110mb.com/'; ///SITE LOCATION $site[img] = 'http://virus-mafia.com/images/'; ///SITE IMAGES //////UPLOAD SETTINGS $dir="../images/icons/$tru/"; $arr_allow_ex=array("gif","jpg","png"); $maxupload[sup] = '5000'; //supporter upload in bytes $maxupload[nor] = '2500'; //normal upload in bytes //////DATABASE CONFIG, AND CONNECTION $db[host] = 'insert'; //DATABASE HOST "mysql4.namesco.net" $db[user] = 'insert'; //DATABASE USERNAME $db[pass] = 'insert'; //DATABASE PASSWORD $db[name] = 'insert'; //DATABASE NAME $connect = mysql_connect($db[host],$db[user], $db[pass]); mysql_select_db("$db[name]") or die ("Could not connect to database"); //////DATABASE TABLES $tab[user] = 'users'; $tab[html] = 'html'; $tab[news] = 'news'; $tab[game] = 'games'; $tab[stat] = 'stats'; $tab[censor] = 'censors'; $tab[banned] = 'bans'; $tab[paypal] = 'paypal'; /////GAME DATABASE TABLES $tab[board] = "board"; $tab[clist] = "contacts"; $tab[city] = "city"; $tab[crew] = "crew"; $tab[invite] = "invites"; $tab[mail] = "mailbox"; $tab[pimp] = "pimp"; $tab[revenge] = "revenges"; $tab[cron] = "cronjobs"; if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game'] WHERE round='$tru' AND starts<$time AND ends>$time;")))) { header(/"Location: $site[location]play.php/"); } if($tru){ $tab[board] = "r".$tru."_board"; $tab[clist] = "r".$tru."_contacts"; $tab[city] = "r".$tru."_city"; $tab[crew] = "r".$tru."_crew"; $tab[invite] = "r".$tru."_invites"; $tab[mail] = "r".$tru."_mailbox"; $tab[pimp] = "r".$tru."_$tab[pimp]"; $tab[revenge] = "r".$tru."_revenges"; $tab[cron] = "r".$tru."_cronjobs"; } //////CENSORS $getcensors = mysql_query("SELECT censor FROM $tab[censor];"); $censorwords = array(); while($censor=mysql_fetch_array($getcensors)) { array_push($censorwords, $censor[0]); } //GRAB THEY MASTER AND GAME ID if($tru){ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[pimp] WHERE code='$trupimpn';")); } else{ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[user] WHERE code='$trupimp';")); } $id=$id[0]; ?> Any ideaz, the person that can help me get this fixed (cuz it is really annoying me ???) can have one of my MMORPG scripts =D Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/ Share on other sites More sharing options...
darkfreaks Posted March 28, 2008 Share Posted March 28, 2008 what is line 45? Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503591 Share on other sites More sharing options...
ohdang888 Posted March 28, 2008 Share Posted March 28, 2008 try this if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game'] WHERE round='$tru' AND starts<$time AND ends>$time;")))){ header(/"Location: $site[location]play.php/"); } instead of this: if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game'] WHERE round='$tru' AND starts<$time AND ends>$time;")))) { header(/"Location: $site[location]play.php/"); } Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503596 Share on other sites More sharing options...
BlueSkyIS Posted March 28, 2008 Share Posted March 28, 2008 the problem is too many right parens on this line: if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game'] WHERE round='$tru' AND starts<$time AND ends>$time;"))) Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503598 Share on other sites More sharing options...
violentj Posted March 28, 2008 Author Share Posted March 28, 2008 ive tried the corrections but still come up with the same error, add me on msn (if u have it) and if you could help me out id be very happy, and i will also give you one of my scripts =D my msn is kenneth.kaniff[a]hotmail.co.uk Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503626 Share on other sites More sharing options...
ohdang888 Posted March 28, 2008 Share Posted March 28, 2008 i think i may have found it... try this: $table = $tab['game']; if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM '$table' WHERE round='$tru' AND starts<$time AND ends>$time;"))) instead of this: if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game'] WHERE round='$tru' AND starts<$time AND ends>$time;"))) EDIT: OR you could ues this: if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM '{$tab['game']}' WHERE round='$tru' AND starts<$time AND ends>$time;"))) Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503640 Share on other sites More sharing options...
violentj Posted March 29, 2008 Author Share Posted March 29, 2008 now im having the following error; Parse error: syntax error, unexpected T_STRING, expecting '}' in /content/StartupHostPlus/v/i/virus-mafia.com/web/setup.php on line 45 This is the code i am using <? $time=time(); $site[location] = 'http://virus-mafia.com/'; ///SITE LOCATION $site[img] = 'http://virus-mafia.com/images/'; ///SITE IMAGES ////UPLOAD SETTINGS $dir="../images/icons/$tru/"; $arr_allow_ex=array("gif","jpg","png"); $maxupload[sup] = '5000'; //supporter upload in bytes $maxupload[nor] = '2500'; //normal upload in bytes //////DATABASE CONFIG, AND CONNECTION $db[host] = '***'; //DATABASE HOST "mysql4.namesco.net" $db[user] = '***'; //DATABASE USERNAME $db[pass] = '***'; //DATABASE PASSWORD $db[name] = '***'; //DATABASE NAME $connect = mysql_connect($db[host],$db[user], $db[pass]); mysql_select_db("$db[name]") or die ("Could not connect to database"); //////DATABASE TABLES $tab[user] = 'users'; $tab[html] = 'html'; $tab[news] = 'news'; $tab[game] = 'games'; $tab[stat] = 'stats'; $tab[censor] = 'censors'; $tab[banned] = 'bans'; $tab[paypal] = 'paypal'; /////GAME DATABASE TABLES $tab[board] = "board"; $tab[clist] = "contacts"; $tab[city] = "city"; $tab[crew] = "crew"; $tab[invite] = "invites"; $tab[mail] = "mailbox"; $tab[pimp] = "pimp"; $tab[revenge] = "revenges"; $tab[cron] = "cronjobs"; if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM '{$tab['game']}' WHERE round='$tru' AND starts<$time AND ends>$time;"))) { header(/"Location: $site[location]play.php/"); } if($tru){ $tab[board] = "r".$tru."_board"; $tab[clist] = "r".$tru."_contacts"; $tab[city] = "r".$tru."_city"; $tab[crew] = "r".$tru."_crew"; $tab[invite] = "r".$tru."_invites"; $tab[mail] = "r".$tru."_mailbox"; $tab[pimp] = "r".$tru."_$tab[pimp]"; $tab[revenge] = "r".$tru."_revenges"; $tab[cron] = "r".$tru."_cronjobs"; } //////CENSORS $getcensors = mysql_query("SELECT censor FROM $tab[censor];"); $censorwords = array(); while($censor=mysql_fetch_array($getcensors)) { array_push($censorwords, $censor[0]); } //GRAB THEY MASTER AND GAME ID if($tru){ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[pimp] WHERE code='$trupimpn';")); } else{ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[user] WHERE code='$trupimp';")); } $id=$id[0]; ?> help is greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504214 Share on other sites More sharing options...
sasa Posted March 29, 2008 Share Posted March 29, 2008 try if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game']} WHERE round='$tru' AND starts<$time AND ends>$time;")))) { header("Location: $site[location]play.php/"); } Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504220 Share on other sites More sharing options...
violentj Posted March 29, 2008 Author Share Posted March 29, 2008 ive already sorted that problem...it is the problem posted 2 above! Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504238 Share on other sites More sharing options...
benjaminbeazy Posted March 29, 2008 Share Posted March 29, 2008 you're missing a parenthesis after your long if statement... Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504250 Share on other sites More sharing options...
violentj Posted March 29, 2008 Author Share Posted March 29, 2008 ive got one havent i? ??? Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504259 Share on other sites More sharing options...
benjaminbeazy Posted March 29, 2008 Share Posted March 29, 2008 is your problem the parse error here.... now im having the following error; Parse error: syntax error, unexpected T_STRING, expecting '}' in /content/StartupHostPlus/v/i/virus-mafia.com/web/setup.php on line 45 This is the code i am using <? $time=time(); $site[location] = 'http://virus-mafia.com/'; ///SITE LOCATION $site[img] = 'http://virus-mafia.com/images/'; ///SITE IMAGES ////UPLOAD SETTINGS $dir="../images/icons/$tru/"; $arr_allow_ex=array("gif","jpg","png"); $maxupload[sup] = '5000'; //supporter upload in bytes $maxupload[nor] = '2500'; //normal upload in bytes //////DATABASE CONFIG, AND CONNECTION $db[host] = '***'; //DATABASE HOST "mysql4.namesco.net" $db[user] = '***'; //DATABASE USERNAME $db[pass] = '***'; //DATABASE PASSWORD $db[name] = '***'; //DATABASE NAME $connect = mysql_connect($db[host],$db[user], $db[pass]); mysql_select_db("$db[name]") or die ("Could not connect to database"); //////DATABASE TABLES $tab[user] = 'users'; $tab[html] = 'html'; $tab[news] = 'news'; $tab[game] = 'games'; $tab[stat] = 'stats'; $tab[censor] = 'censors'; $tab[banned] = 'bans'; $tab[paypal] = 'paypal'; /////GAME DATABASE TABLES $tab[board] = "board"; $tab[clist] = "contacts"; $tab[city] = "city"; $tab[crew] = "crew"; $tab[invite] = "invites"; $tab[mail] = "mailbox"; $tab[pimp] = "pimp"; $tab[revenge] = "revenges"; $tab[cron] = "cronjobs"; if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM '{$tab['game']}' WHERE round='$tru' AND starts<$time AND ends>$time;"))) { header(/"Location: $site[location]play.php/"); } if($tru){ $tab[board] = "r".$tru."_board"; $tab[clist] = "r".$tru."_contacts"; $tab[city] = "r".$tru."_city"; $tab[crew] = "r".$tru."_crew"; $tab[invite] = "r".$tru."_invites"; $tab[mail] = "r".$tru."_mailbox"; $tab[pimp] = "r".$tru."_$tab[pimp]"; $tab[revenge] = "r".$tru."_revenges"; $tab[cron] = "r".$tru."_cronjobs"; } //////CENSORS $getcensors = mysql_query("SELECT censor FROM $tab[censor];"); $censorwords = array(); while($censor=mysql_fetch_array($getcensors)) { array_push($censorwords, $censor[0]); } //GRAB THEY MASTER AND GAME ID if($tru){ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[pimp] WHERE code='$trupimpn';")); } else{ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[user] WHERE code='$trupimp';")); } $id=$id[0]; ?> help is greatly appreciated if so... add a parenthesis to the end of this line..... if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM '{$tab['game']}' WHERE round='$tru' AND starts<$time AND ends>$time;")))) Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504263 Share on other sites More sharing options...
violentj Posted March 29, 2008 Author Share Posted March 29, 2008 hold on it didnt post it =( this is the error, Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /content/StartupHostPlus/v/i/virus-mafia.com/web/setup.php on line 63 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /content/StartupHostPlus/v/i/virus-mafia.com/web/setup.php on line 69 This is the code <? $time=time(); $site[location] = 'http://virus-mafia.com/'; ///SITE LOCATION $site[img] = 'http://virus-mafia.com/images/'; ///SITE IMAGES ////UPLOAD SETTINGS $dir="../images/icons/$tru/"; $arr_allow_ex=array("gif","jpg","png"); $maxupload[sup] = '5000'; //supporter upload in bytes $maxupload[nor] = '2500'; //normal upload in bytes //////DATABASE CONFIG, AND CONNECTION $db[host] = '***'; //DATABASE HOST "mysql4.namesco.net" $db[user] = '***'; //DATABASE USERNAME $db[pass] = '***'; //DATABASE PASSWORD $db[name] = '***'; //DATABASE NAME $connect = mysql_connect($db[host],$db[user], $db[pass]); mysql_select_db("$db[name]") or die ("Could not connect to database"); //////DATABASE TABLES $tab[user] = 'users'; $tab[html] = 'html'; $tab[news] = 'news'; $tab[game] = 'games'; $tab[stat] = 'stats'; $tab[censor] = 'censors'; $tab[banned] = 'bans'; $tab[paypal] = 'paypal'; /////GAME DATABASE TABLES $tab[board] = "board"; $tab[clist] = "contacts"; $tab[city] = "city"; $tab[crew] = "crew"; $tab[invite] = "invites"; $tab[mail] = "mailbox"; $tab[pimp] = "pimp"; $tab[revenge] = "revenges"; $tab[cron] = "cronjobs"; if(($tru) && (!mysql_fetch_row(mysql_query("SELECT round FROM {$tab['game']} WHERE round='$tru' AND starts<$time AND ends>$time;")))) { header("Location: $site[location]play.php/"); } if($tru){ $tab[board] = "r".$tru."_board"; $tab[clist] = "r".$tru."_contacts"; $tab[city] = "r".$tru."_city"; $tab[crew] = "r".$tru."_crew"; $tab[invite] = "r".$tru."_invites"; $tab[mail] = "r".$tru."_mailbox"; $tab[pimp] = "r".$tru."_$tab[pimp]"; $tab[revenge] = "r".$tru."_revenges"; $tab[cron] = "r".$tru."_cronjobs"; } //////CENSORS $getcensors = mysql_query("SELECT censor FROM $tab[censor];"); $censorwords = array(); while($censor=mysql_fetch_array($getcensors)) { array_push($censorwords, $censor[0]); } //GRAB THEY MASTER AND GAME ID if($tru){ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[pimp] WHERE code='$trupimpn';")); } else{ $id = mysql_fetch_array(mysql_query("SELECT id FROM $tab[user] WHERE code='$trupimp';")); } $id=$id[0]; ?> sorry bout that :'( Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504271 Share on other sites More sharing options...
ohdang888 Posted March 29, 2008 Share Posted March 29, 2008 tell us what line 69 is. we don t have time to count. lol. Quote Link to comment https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504316 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.