PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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';
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.
The only difference is that there are many more input fields but they are all done in the same way. The submit makes the page redirect and I have a test message at the top of "ticketVars.php" that displays so it is submiting.
I had wondered if the error was from mysql but it seems to be from php as it has to do with the line number for the insert statement before the insert is actually executed. and I get the "roll back" message at the end of the list of errors so I think mysql is working as it should.
Once again, sorry. The quote is not missing from the actual code. I was trying not to have to post the entire code but just an example of what is giving me the error. I'll have to come back and post the actual code in a little while when I get a few free minutes.