Hi All,
I am trying to the following for an appointments system. So far i am able to add to my Sql table 'bookings' values i select from a drop down stored as $day, $month, $year and $time.
I want to be able to do a check nefore a write the row to the database to see if a record with the same day mont year time already exists - but not too sure how. Can anyone tell me where in my php code i can put this check!
<?php
if ($_POST["addClient"]=="yes") {
// retrieve values from system $_POST variable
$day=$_POST["day"];
$month=$_POST["month"];
$year=$_POST["year"];
$time=$_POST["time"];
include("dbVariables.php");
// connect to database
$db = mysql_connect($dbHost, $dbUsername, $dbPassword);
mysql_select_db($databasename,$db);
// compose query and send
$dbQuery="INSERT INTO bookings VALUES ('$day', '$month', '$year', '$time')";
$result = mysql_query($dbQuery,$db);
} else {}
?>
Thanks in Advance :)