Jump to content


Photo

parse error


  • Please log in to reply
3 replies to this topic

#1 mei_913

mei_913
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 20 July 2006 - 04:35 AM

<?php require_once('Connections/conn_member.php'); ?>
<?php
if(!isset($_REQUEST['date'])){ 
   $date = date("Y-m-d",mktime()); } else { 
   $date = $_REQUEST['date']; } 

// Read booking record from tbBooking
mysql_select_db($database_conn_member, $conn_member);
$rsBooking = mysql_query("SELECT * FROM tbbooking WHERE `book_date` = '$date'", $conn_member) or die(mysql_error());
if (mysql_num_rows($rsBooking)>0) echo"You have booking today!"; 

//Delete existing table tbTemp
mysql_query("DROP TABLE `tbTemp` ;");

// Read Beautician
$query_rsBeautician = "SELECT beau_id,beau_name FROM tbbeautician ORDER BY beau_id ASC";
$rsBeautician = mysql_query($query_rsBeautician, $conn_member) or die(mysql_error());
$totalRows_rsBeautician = mysql_num_rows($rsBeautician);

// Creating table tbTemp
mysql_query("CREATE TABLE `tbTemp` ( `beau_id` INT( 3 ) NOT NULL, `beau_name` VARCHAR( 15 ) NOT NULL) TYPE = MYISAM ;") or die("Table already exist !!!");
$i=1;
while ($i<139)
 {
mysql_query("ALTER TABLE `tbTemp` ADD `$i` int( 1 ) NOT NULL DEFAULT '0' ;");
$i++;}

// INSERT data into table tbTemp
while ($GetBeau= mysql_fetch_array($rsBeautician))
 {
mysql_query("INSERT INTO `tbTemp` ( `beau_id` , `beau_name` , `T1`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`,`T8`,`T9`,`T10`,`T11`,`T12`,`T13`,`T14`,`T15`,`T16`,`T17`,`T18`,`T19`,`T20`,`T21`,`T22`,`T23`,`T24`,`T25`,`T26`,`T27`,`T28`,`T29`,`T30`,`T31`,`T32`,`T33`,`T34`,`T35`,`T36`,`T37`,`T38`,`T39`,`T40`,`T41`,`T42`,`T43`,`T44`,`T45`,`T46`,`T47`,`T48`,`T49`,`T50`,`T51`,`T52`,`T53`,`T54`,`T55`,`T56`,`T57`,`T58`,`T59`,`T60`,`T61`,`T62`,`T63`,`T64`,`T65`,`T66`,`T67`,`T68`,`T69`,`T70`,`T71`,`T72`,`T73`,`T74`,`T75`,`T76`,`T77`,`T78`,`T79`,`T80`,`T81`,`T82`,`T83`,`T84`,`T85`,`T86`,`T87`,`T88`,`T89`,`T90`,`T91`,`T92`,`T93`,`T94`,`T95`,`T96`,`T97`,`T98`,`T99`,`T100`,`T101`,`T102`,`T103`,`T104`,`T105`,`T106`,`T107`,`T108`,`T109`,`T110`,`T111`,`T112`,`T113`,`T114`,`T115`,`T116`,`T117`,`T118`,`T119`,`T120`,`T121`,`T122`,`T123`,`T124`,`T125`,`T126`,`T127`,`T128`,`T129`,`T130`,`T131`,`T132`,`T133`,`T134`,`T135`,`T136`,`T137`,`T138`) 
VALUES ('$GetBeau[beau_id]', '$GetBeau[beau_name]', '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');");
}

// UPDATE tbTemp , determine booking
if (mysql_num_rows($rsBooking)>0) 
{

while ($BookingRecord=mysql_fetch_assoc($rsBooking))
{
for ($i=$BookingRecord['time_start']; $i<=$BookingRecord['time_end']; $i++)
{
$TempUpdate = mysql_query(sprintf('UPDATE tbTemp SET \'%s\'=1 WHERE beau_id=%s',$i,$BookingRecord[beau_id]), $conn_member)or die (mysql_error());
}
}
mysql_free_result($rsBooking);
mysql_free_result($rsBeautician);
mysql_free_result($BookingRecord);

?>

Parse error: parse error, unexpected $
in /home/spasensati/domains/spasensationintl.com/public_html/apply/schedule.php on line 101
(which is </html>

HELP ME!!!

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 July 2006 - 04:06 PM

First, I don't see a close html tag anywhere, nor is there a line 101...
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 20 July 2006 - 05:08 PM

Looks like an unclosed loop, which can be corrected with the code below replacing yours:

// UPDATE tbTemp , determine booking
if (mysql_num_rows($rsBooking)>0) {
    while ($BookingRecord=mysql_fetch_assoc($rsBooking)) {
        for ($i=$BookingRecord['time_start']; $i<=$BookingRecord['time_end']; $i++) {
            $TempUpdate = mysql_query(sprintf('UPDATE tbTemp SET \'%s\'=1 WHERE beau_id=%s',$i,$BookingRecord[beau_id]), $conn_member)or die (mysql_error());
        }
    }
}
mysql_free_result($rsBooking);
mysql_free_result($rsBeautician);
mysql_free_result($BookingRecord);

Legend has it that reading the manual never killed anyone.
My site

#4 treilad

treilad
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 20 July 2006 - 05:10 PM

If you get a parse error towards the end where there's ?> or nothing, it's usually because you /need/ something there. Such as an extra '}'.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users