Jump to content

PHP SQL appointment checker


carlbrooker

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/10845-php-sql-appointment-checker/
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.