I am trying to write a php code for my website and have run into some problems...?

Michael L

New member
Any help or guidance would be appreciated.
Ok, here goes.
I am a photographer and am trying to develop a php code to search a database for a date entered into a form. I want it to tell the potential client if they're page is available or not, but I have done something wrong because it produces both results at the same time...if anyone could tell me where my code went wrong I would greatly appreciate it.

<?php

mysql_connect ("localhost", "username", "password") or die (mysql_error());
mysql_select_db ("database");

$Month = $_POST['Month'];
$Day = $_POST['Day'];
$Year = $_POST['Year'];

$Date = "'$Month' '$Day' '$Year'";

$sql = mysql_query("select * from table where Date is like '%$Date%'");

if ($sql = $Date){

print ("Sorry, your wedding date is not available.");

}{

print ("Congratulations, your wedding date is available!");

}




?>
 
Back
Top