PDA

View Full Version : Echo Query so I can See What it is saying


dprichard
07-18-2008, 04:44 PM
I am trying to do an update that isn't working and was wondering how I could echo the query back out onto the page so I can see what it is actually saying. I tried this, but it didn't work.

if(isset($_POST['simulate']) && $_POST['simulate'] == 99) {

$todaysdate = '';

$todaysdate = mysql_real_escape_string($_POST['todaysdate']);

$updatequery = mysql_query("UPDATE EmployeeTimeOff SET CurrentAccrualAmount = (CurrentAccrualAmount + AccrualRate) WHERE NextAccrualDate = '$todaysdate' AND EmployeeId = '1'") or die(mysql_error());

echo $updatequery;

}

oesxyl
07-18-2008, 05:28 PM
try this way:

if(isset($_POST['simulate']) && $_POST['simulate'] == 99) {

$todaysdate = '';

$todaysdate = mysql_real_escape_string($_POST['todaysdate']);
$query = "UPDATE EmployeeTimeOff SET CurrentAccrualAmount = (CurrentAccrualAmount + AccrualRate) WHERE NextAccrualDate = '$todaysdate' AND EmployeeId = '1'";
$updatequery = mysql_query($query) or die(mysql_error());

echo $query;

}

regards