Hi, I get the following when I try to execute: What is wrong? expiry was updated successfully. Warning: Use of undefined constant expiry - assumed 'expiry' (this will throw an Error in a future version of PHP) on line 14 Warning: Use of undefined constant expiry - assumed 'expiry' (this will throw an Error in a future version of PHP) on line 15 Warning: Use of undefined constant expiry - assumed 'expiry' (this will throw an Error in a future version of PHP) on line 16 --------------------------------------------------------------- the code <?php $link = mysqli_connect("localhost", "root", "", "prerentdb"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } echo "<center>";echo date('m/d/y'); echo "<br />"; $id='id'; $expiry='expiry'; $sql = "UPDATE paytbl SET $expiry = $expiry-1 where id = '$id'"; if(mysqli_query($link, $sql)){ echo "expiry was updated successfully."; } else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } if(expiry == 7) {echo "1 week remaining on contract";} elseif (expiry == 1) {echo "1 day remaining on contract";} elseif (expiry == 0) {echo "contact xxxxx.com to renew and continue use";} // Close connection mysqli_close($link); ?>
the code <?php $link = mysqli_connect("localhost", "root", "", "prerentdb"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } echo "<center>";echo date('m/d/y'); echo "<br />"; $id='id'; $expiry='expiry'; $sql = "UPDATE paytbl SET $expiry = $expiry-1 where id = '$id'"; if(mysqli_query($link, $sql)){ echo "expiry was updated successfully."; } else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } if(expiry == 7) {echo "1 week remaining on contract";} elseif (expiry == 1) {echo "1 day remaining on contract";} elseif (expiry == 0) {echo "contact xxxxx.com to renew and continue use";} // Close connection mysqli_close($link); ?>
$expiry
$sql = "UPDATE paytbl SET $expiry = $expiry-1 where id = '$id'";
1
'expiry'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)