Jump to content

mei_913

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mei_913's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. HI everyone! I have a problem with finding date within a range. In my database, there's a table with a field "updatedate", which is of date type. I want to find out the record with an "updatedate" within a range (typed by user), but i do not know the syntax for comparing date (YYYY-MM-DD). I've tried ">=" and "<=" but in vain. Can anyone help me?? Thanks a lot!!!
  2. [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!!!
  3. Warning: mysql_free_result(): 6 is not a valid MySQL result resource in c:\program files\easyphp1-8\www\apply\modify.php on line 111 THIS SENTENCE APPEARED WHEN I TRIED TO RUN MY PHP WEBPAGE!!! <?php require_once('Connections/conn_member.php'); ?> <?php require_once('Connections/conn_member.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE tbmember SET username_eng=%s, username_nick=%s, cons_id=%s, beau_id=%s, joinday=%s, birthday=%s, phone=%s, address=%s, email=%s, sex=%s, occupation=%s, book_time=%s, reactivity=%s, remark=%s, medicaltreat=%s, surgery=%s, medicine=%s, heartdisease=%s, allergy=%s, skin=%s, bloodpressure=%s, asthma=%s, epilepsy=%s, diabetes=%s, metal=%s, otherdisease=%s, insomnia=%s, stress=%s, busy=%s, relax=%s, alcoholic=%s, smoking=%s, spice=%s, sweet=%s, coffee=%s WHERE username_chi=%s", GetSQLValueString($_POST['username_eng'], "text"), GetSQLValueString($_POST['username_nick'], "text"), GetSQLValueString($_POST['cons_id'], "text"), GetSQLValueString($_POST['beau_id'], "text"), GetSQLValueString($_POST['joinday'], "date"), GetSQLValueString($_POST['birthday'], "date"), GetSQLValueString($_POST['phone'], "int"), GetSQLValueString($_POST['address'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['sex'], "text"), GetSQLValueString($_POST['occupation'], "text"), GetSQLValueString($_POST['book_time'], "int"), GetSQLValueString($_POST['reactivity'], "int"), GetSQLValueString($_POST['remark'], "text"), GetSQLValueString($_POST['medicaltreat'], "text"), GetSQLValueString($_POST['surgery'], "text"), GetSQLValueString($_POST['medicine'], "text"), GetSQLValueString(isset($_POST['heartdisease']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['allergy']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['skin']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['bloodpressure']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['asthma']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['epilepsy']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['diabetes']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['metal']) ? "true" : "", "defined","1","0"), GetSQLValueString($_POST['otherdisease'], "text"), GetSQLValueString(isset($_POST['insomnia']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['stress']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['busy']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['relax']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['alcoholic']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['smoking']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['spice']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['sweet']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['coffee']) ? "true" : "", "defined","1","0"), GetSQLValueString($_POST['username_chi'], "text")); mysql_select_db($database_conn_member, $conn_member); $Result1 = mysql_query($updateSQL, $conn_member) or die(mysql_error()); $updateGoTo = "complete.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } mysql_select_db($database_conn_member, $conn_member); $query_rsConsultant = "SELECT cons_id, cons_name FROM tbconsultant"; $rsConsultant = mysql_query($query_rsConsultant, $conn_member) or die(mysql_error()); $row_rsConsultant = mysql_fetch_assoc($rsConsultant); $totalRows_rsConsultant = mysql_num_rows($rsConsultant); mysql_select_db($database_conn_member, $conn_member); $query_rsBeautician = "SELECT beau_id, beau_name FROM tbbeautician"; $rsBeautician = mysql_query($query_rsBeautician, $conn_member) or die(mysql_error()); $row_rsBeautician = mysql_fetch_assoc($rsBeautician); $totalRows_rsBeautician = mysql_num_rows($rsBeautician); $colname_rsCustomerData = "-1"; if (isset($_GET['userid'])) { $colname_rsCustomerData = (get_magic_quotes_gpc()) ? $_GET['userid'] : addslashes($_GET['userid']); } mysql_select_db($database_conn_member, $conn_member); $query_rsCustomerData = sprintf("SELECT * FROM tbmember WHERE userid = '%s'", $colname_rsCustomerData); $rsCustomerData = mysql_query($query_rsCustomerData, $conn_member) or die(mysql_error()); $row_rsCustomerData = mysql_fetch_assoc($rsCustomerData); $totalRows_rsCustomerData = mysql_num_rows($rsCustomerData); mysql_free_result($rsBeautician); mysql_free_result($rsCustomerData); mysql_free_result($rsConsultant); mysql_free_result($rsBeautician); ?>
  4. i want to enter the data submited by the user in the form into different tables in a database as the "select" form varies. For example, when the user select "A", the whole form would be posted to "A" table in database. Can anyone help me?? THANK YOU SOOOOO MUCH!!!!!!
  5. [code]<?php require_once('Connections/conn_member.php'); ?> <?php if (!isset($_SESSION)) {   session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {   // For security, start by assuming the visitor is NOT authorized.   $isValid = False;   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.   // Therefore, we know that a user is NOT logged in if that Session variable is blank.   if (!empty($UserName)) {     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.     // Parse the strings into arrays.     $arrUsers = Explode(",", $strUsers);     $arrGroups = Explode(",", $strGroups);     if (in_array($UserName, $arrUsers)) {       $isValid = true;     }     // Or, you may restrict access to only certain users based on their username.     if (in_array($UserGroup, $arrGroups)) {       $isValid = true;     }     if (($strUsers == "") && true) {       $isValid = true;     }   }   return $isValid; } $MM_restrictGoTo = "login.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {     $MM_qsChar = "?";   $MM_referrer = $_SERVER['PHP_SELF'];   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";   if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)   $MM_referrer .= "?" . $QUERY_STRING;   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);   header("Location: ". $MM_restrictGoTo);   exit; } ?> <?php $colname_rsCustomerData = "-1"; if (isset($_GET['userid'])) {   $colname_rsCustomerData = (get_magic_quotes_gpc()) ? $_GET['userid'] : addslashes($_GET['userid']); } mysql_select_db($database_conn_member, $conn_member); $query_rsCustomerData = sprintf("SELECT tbbeautician.beau_name, tbbeautician.`identity`, tbconsultant.cons_name, tbmember.username_chi, tbmember.username_eng, tbmember.username_nick, tbmember.userid, tbmember.joinday, tbmember.birthday, tbmember.phone, tbmember.address, tbmember.email, tbmember.sex, tbmember.occupation, tbmember.book_time, tbmember.reactivity, tbmember.remark, tbmember.medicaltreat, tbmember.surgery, tbmember.medicine, tbmember.heartdisease, tbmember.allergy, tbmember.skin, tbmember.bloodpressure, tbmember.asthma, tbmember.epilepsy, tbmember.diabetes, tbmember.metal, tbmember.otherdisease, tbmember.insomnia, tbmember.stress, tbmember.busy, tbmember.relax, tbmember.alcoholic, tbmember.smoking, tbmember.spice, tbmember.sweet, tbmember.coffee FROM tbmember, tbbeautician, tbconsultant WHERE userid = '%s' AND tbconsultant.cons_id=tbmember.cons_id AND tbmember.beau_id=tbbeautician.beau_id", $colname_rsCustomerData); $rsCustomerData = mysql_query($query_rsCustomerData, $conn_member) or die(mysql_error()); $row_rsCustomerData = mysql_fetch_assoc($rsCustomerData); $totalRows_rsCustomerData = mysql_num_rows($rsCustomerData); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5" /> <title>Customer Info</title> <style type="text/css"> <!-- body,td,th {     font-family: Verdana, Arial, Helvetica, sans-serif;     font-size: 12px;     color: #666666; } --> </style></head> <body> <strong>Customer Info</strong><br /> <hr align="left" width="80%" noshade="noshade" /> <table height="395" border="0" cellpadding="5" cellspacing="0" onsubmit="MM_validateForm('username','','R','userid','','R','phone_home','','NisNum','phone_mobile','','NisNum','email','','NisEmail','pass','','R');return document.MM_returnValue">   <tr>     <td width="108" height="18"><div align="center">Chinese Name</div></td>     <td width="269"><?php echo $row_rsCustomerData['username_chi']; ?></td>   </tr>   <tr>     <td><div align="center">English Name</div></td>     <td><?php echo $row_rsCustomerData['username_eng']; ?></td>   </tr>   <tr>     <td><div align="center">Nickname</div></td>     <td><?php echo $row_rsCustomerData['username_nick']; ?></td>   </tr>   <tr>     <td height="19"><div align="center">User ID</div></td>     <td><?php echo $row_rsCustomerData['userid']; ?></td>   </tr>   <tr>     <td><div align="center">Consultant</div></td>     <td><?php echo $row_rsCustomerData['cons_name']; ?></td>   </tr>   <tr>     <td><div align="center">Beautician</div></td>     <td><?php echo $row_rsCustomerData['beau_name']; ?> (<?php if ($row_rsCustomerData['identity']==1) echo "Beautician"; if ($row_rsCustomerData['identity']==2) echo "Massage"; ?> )  </td>   </tr>   <tr>     <td><div align="center">Join Date</div></td>     <td><?php echo $row_rsCustomerData['joinday']; ?></td>   </tr>   <tr>     <td><div align="center">Date of Birth</div></td>     <td><?php echo $row_rsCustomerData['birthday']; ?></td>   </tr>   <tr>     <td height="18"><div align="center">Tel</div></td>     <td><?php echo $row_rsCustomerData['phone']; ?></td>   </tr>   <tr>     <td height="18"><div align="center">Address</div></td>     <td><?php echo $row_rsCustomerData['address']; ?></td>   </tr>   <tr>     <td height="18"><div align="center">E-mail</div></td>     <td><?php echo $row_rsCustomerData['email']; ?></td>   </tr>   <tr>     <td><div align="center">Gender</div></td>     <td><?php echo $row_rsCustomerData['sex']; ?></td>   </tr>   <tr>     <td><div align="center">Occupation</div></td>     <td><?php echo $row_rsCustomerData['occupation']; ?></td>   </tr>   <tr>     <td><div align="center">Booking Time</div></td>     <td><?php echo $row_rsCustomerData['book_time']; ?>:00</td>   </tr>   <tr>     <td height="40"><p align="center">Reactivity</p></td>     <td><?php     while ($row_rsCustomerData['reactivity']>0) {     echo "*";     $row_rsCustomerData['identity']--;     ?></td>   </tr>   <tr>     <td height="27"><div align="center">Remark</div></td>     <td><?php echo $row_rsCustomerData['remark']; ?></td>   </tr>   <tr>     <td height="51" rowspan="3"><div align="center">Medical History</div></td>     <td rowspan="3"><?php if($row_rsCustomerData['heartdisease']==1) echo "Heart Disease "; ?>     <?php if($row_rsCustomerData['allergy']==1) echo "Allergy "; ?>     <?php if($row_rsCustomerData['skin']==1) echo "Skin Disease "; ?>     <?php if($row_rsCustomerData['bloodpressure']==1) echo "High/Low Blood Pressure "; ?>     <?php if($row_rsCustomerData['asthma']==1) echo "Asthma "; ?>     <?php if($row_rsCustomerData['epilepsy']==1) echo "Epilepsy "; ?>     <?php if($row_rsCustomerData['diabetes']==1) echo "Diabetes"; ?>     <?php if($row_rsCustomerData['metal']==1) echo "Metal Plates "; ?>     <?php echo $row_rsCustomerData['otherdisease']; ?></td>   </tr>   <tr> </tr>   <tr> </tr>   <tr>     <td height="25"><div align="center">Latest Medical Treatment</div></td>     <td><?php echo $row_rsCustomerData['medicaltreat']; ?></td>   </tr>   <tr>     <td height="13"><div align="center">Latest Surgery</div></td>     <td><?php echo $row_rsCustomerData['surgery']; ?></td>   </tr>   <tr>     <td height="6"><div align="center">To take certain medicine chronically</div></td>     <td><?php echo $row_rsCustomerData['medicine']; ?></td>   </tr>   <tr>     <td height="7"><div align="center">Life Style</div></td>     <td><?php if($row_rsCustomerData['insomnia']==1) echo"Insomnia "; ?>     <?php if($row_rsCustomerData['stress']==1) echo"Stress "; ?>     <?php if($row_rsCustomerData['busy']==1) echo"Busy "; ?>     <?php if($row_rsCustomerData['relax']==1) echo"Relax "; ?>     </td>   </tr>   <tr>     <td height="13"><div align="center">Habits</div></td>     <td><?php if($row_rsCustomerData['alcoholic']==1) echo"Alcoholic ";?>     <?php if($row_rsCustomerData['smoking']==1) echo"Smoking ";?>     <?php if($row_rsCustomerData['spice']==1) echo"Spice ";?>     <?php if($row_rsCustomerData['sweet']==1) echo"Sweet ";?>     <?php if($row_rsCustomerData['coffee']==1) echo"Coffee ";?></td>   </tr> </table> <p>&nbsp;</p> </body> </html> <?php mysql_free_result($rsCustomerData); ?>[/code] Parse error: parse error in c:\program files\easyphp1-8\www\apply\detail.php on line 190 That's what o could see when i try to load it PLEASE HELP ME!!!
×
×
  • 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.