Jump to content

Archived

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

carlbrooker

PHP SQL appointment checker

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

Share this post


Link to post
Share on other sites
You have forgotten the closing " in the SELECT statement.

Share this post


Link to post
Share on other sites

×

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.