Jump to content

unexpected T_AS


Phpfr3ak

Recommended Posts

Getting the following error Parse error: syntax error, unexpected T_AS in C:\Program Files\EasyPHP-5.3.3\www\public_html\PlayerRanks.php on line 22, really unsure as to why any insight please? Thanks

$sql = "SELECT * FROM hitlist WHERE player_id = '$playerID'";
$que = mysql_query($sql) or die(mysql_error()); 
if (is_array($que['hit_id'] as $hits) {

  foreach ($que['hit_id'] as $hits) {
   //do somthing
  }
}
else

Link to comment
Share on other sites

I dont know what im looking for is the honest truth, i just want to look it to see if $addIDs_ary is already set as hit_id in the table hitlist where the players_id = $playersID,, i get how to do it normally buy doing it for multiple results just baffles my mind

Link to comment
Share on other sites

You are getting a php syntax error on a specific line in your code, indicating an unexpected AS (the T in T_AS means TOKEN - i.e. php is a parsed, Tokenized, interpreted language) was found on that line. If you look at that actual line in your code, you will see that you have used an as $hits inside an is_array statement. Since the purpose of an is_array statement is to test if the supplied argument is an array, why do you have the as $hits in there?

 

Sorry to be blunt again, but you simply must think about what you are doing when you write and debug your code. You must also lookup what each statement does. is_array — Finds whether a variable is an array. The only thing is_array takes as a parameter is a variable name that may or may not be an array.

 

 

Link to comment
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.