Jump to content


Photo

PHP SQL appointment checker


  • Please log in to reply
2 replies to this topic

#1 carlbrooker

carlbrooker
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 31 May 2006 - 10:47 AM

i have this code and keep getting an error at the line "$msg=$msg. "Appointment Already taken, please make another <BR>";

The code is checking whether the appointment is already taken.
Can anyone help. Here is the full code and the error

Code:

<?
include("sqlvars.php");

$connection = mysql_connect("$servername","$dbusername","$dbpassword");

if (!$connection) die ("Could not connect MySQL");
mysql_select_db($dbname,$connection) or die ("Could not open database");

if(isset($todo) and $todo=="post"){

$status = "OK";
$msg= "";

if(mysql_num_rows(mysql_query("SELECT vetid,date,time FROM appointments WHERE vetid = '$vetid' AND date = '$dateYr-$dateMonth-$dateDay' AND time = '$time';))){
$msg=$msg. "Appointment Already taken, please make another <BR>";
$status= "NOTOK";}

if($status<>"OK"){
echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>";
}else{ // if all validations are passed.
$query=mysql_query("insert into appointments(userid,petid,vetid,date,time,reason) values('$session[userid]','$petid','$vetid','$dateYr-$dateMonth-$dateDay','$time','$reason')");
echo "<font face='Verdana' size='2' color=green>Thank you for booking your appointment on $dateYr-$dateMonth-$dateDay at $time<br></font>";

}
}
?>

Error:

Parse error: parse error, unexpected T_STRING in /vets/mkappointck.php on line 15



#2 AndyB

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

Posted 31 May 2006 - 11:05 AM

You have forgotten the closing " in the SELECT statement.
Legend has it that reading the manual never killed anyone.
My site

#3 carlbrooker

carlbrooker
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 31 May 2006 - 12:06 PM

All working now! Many Thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users