hi, someone please help. I can’t seem to get my head around this new stuff,
and I’ve been told I have a big head. I get the below message before I
take any action. The message is correct.
'update_taxrate' was not set, so no update attempted.
[code]
body { background: #cff; } form { text-align: center; }Select state/rate
4% Alabama 5.6% Arkansas
[/code][php]<?php
ini_set(‘display_errors’, true);
error_reporting(E_ALL);
$dbconnect = mysqli_connect(‘localhost’,‘root’,’’);
if($dbconnect == false) {
throw new Exception("Connect failed: ".mysqli_connect_error());
}
if(mysqli_select_db($dbconnect, ‘homedb’) == false) {
throw new Exception("Select DB failed: ".mysqli_error($dbconnect));
}
$taxrate = (isset($_POST[‘submit’])) ? mysqli_real_escape_string($dbconnect, $_POST[‘taxrate’]) : ‘’;
$id = (isset($_POST[‘id’])) ? mysqli_real_escape_string($dbconnect, $_POST[‘id’]) : ‘’;
$result = mysqli_query($dbconnect, “SELECT * FROM numbers”);
if (!empty($_POST[‘id’]) ($_POST[‘update_taxrate’])) {
$sql = “UPDATE numbers SET taxrate = ‘$taxrate’ WHERE id =’$id’”;
$update = mysqli_query($dbconnect, $sql);
if($update == false) {
throw new Exception("Update query failed: ".mysqli_error($dbconnect).PHP_EOL.$sql);
}
echo “Taxrate set for “.mysqli_affected_rows($dbconnect).” row(s).”;
}
else {
echo “‘update_taxrate’ was not set, so no update attempted.”;
}
?>[/php]