If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > syntax error, unexpected ';' on line 24

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-09, 16:19
hscorp hscorp is offline
Registered User
 
Join Date: Mar 2009
Posts: 11
syntax error, unexpected ';' on line 24

this page has
Quote:
PHP Parse error: syntax error, unexpected ';' on line 24
can anyone check the page

this is line 24
PHP Code:
$getTotalHosts mysql_query("SELECT * FROM mirror WHERE uid = '$file_id'"  or die(mysql_error()); 
and this is the whole page

PHP Code:
<?php

require 'includes/db.inc.php';

function 
sanitize($input){
    if(
is_array($input)){
        foreach(
$input as $k=>$i){
            
$output[$k]=sanitize($i);
        }
    }
    else{
        
$output=mysql_real_escape_string($input);
    }   
   
    return 
$output;
}
$_GET=sanitize($_GET);

$file_id $_GET['uid'];




$getTotalHosts mysql_query("SELECT * FROM mirror WHERE uid = '$file_id'"  or die(mysql_error());
$getCompleteHosts mysql_query("SELECT * FROM mirror WHERE uid = '$file_id'" and status in (2,3) or die(mysql_error());


$getTotalHostCount mysql_num_rows($getTotalHosts);
$getCompleteHostCount mysql_num_rows($getCompleteHosts);

$count=0;

if (
$getTotalHostCount == $getCompleteHostCount)
{
    
$count=1;
    

}

echo 
$count;


}

?>
Reply With Quote
  #2 (permalink)  
Old 10-17-09, 17:09
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Looks like the bracketing is wrong in that line:
Code:
$getTotalHosts = mysql_query("SELECT * FROM mirror 
         WHERE uid = '$file_id'"  or die(mysql_error());
It should be:
Code:
$getTotalHosts = mysql_query("SELECT * FROM mirror 
          WHERE uid = '$file_id'")  or die(mysql_error());
The following line also looks wrong:
Code:
$getCompleteHosts = mysql_query("SELECT * FROM mirror 
          WHERE uid = '$file_id'" and status in (2,3) or die(mysql_error());
Shouldn't it be:
Code:
$getCompleteHosts = mysql_query("SELECT * FROM mirror 
          WHERE uid = '$file_id' and status in (2,3)") or die(mysql_error());
It also helps if you print out the sql in your die statement.

Mike
Reply With Quote
  #3 (permalink)  
Old 10-17-09, 17:43
hscorp hscorp is offline
Registered User
 
Join Date: Mar 2009
Posts: 11
thanks it works now
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On