Jump to content

parse error


mei_913

Recommended Posts

[code]
<?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);

?>

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

HELP ME!!!
Link to comment
https://forums.phpfreaks.com/topic/15102-parse-error/
Share on other sites

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

[code]// 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);
[/code]
Link to comment
https://forums.phpfreaks.com/topic/15102-parse-error/#findComment-61162
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.