Undefined variable: php mysql error
Posted: Sat Jun 26, 2010 10:01 pm
Hi,
I have a form with several variables and am getting warning about undefined variable. Also when I submit nothing gets added to the database.
This displays the error:
Notice: Undefined variable: fName in /home/isimmons/public_html/testdir/bonachela/includes/ticketVarsInc.php on line 162
There are actually about 20 variables that all get this error but to make the post short the above code is what is giving me the problem.
Thanks for any suggestions or help
I have a form with several variables and am getting warning about undefined variable. Also when I submit nothing gets added to the database.
Code: Select all
include 'transaction.php';
include 'dbopen.php';
$fName = $_POST['fName'];
begin(); //this is the begin transaction function
$customersql = "INSERT INTO customer (fName) VALUES ($fName);
$custResult = mysql_query($customersql or die (mysql_error()));
if(!$custResult)
{
rollback(); // transaction rolls back
error_reporting(E_ALL);
ini_set('display_errors', '1');
echo "you rolled back";
exit;
}
else
{
commit(); // transaction is committed
echo "Success!";
}
include 'db/dbclose.php';
Notice: Undefined variable: fName in /home/isimmons/public_html/testdir/bonachela/includes/ticketVarsInc.php on line 162
There are actually about 20 variables that all get this error but to make the post short the above code is what is giving me the problem.
Thanks for any suggestions or help