Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/98410-string-error/
Share on other sites

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/"); }

Link to comment
https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503596
Share on other sites

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;")))

 

Link to comment
https://forums.phpfreaks.com/topic/98410-string-error/#findComment-503640
Share on other sites

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  :D

Link to comment
https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504214
Share on other sites

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  :D

 

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;"))))

Link to comment
https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504263
Share on other sites

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  :'(

Link to comment
https://forums.phpfreaks.com/topic/98410-string-error/#findComment-504271
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.