Is there any basic, sure fire 'if - else' script that will ensure that
records entered into my form will actually be written to the database?
I noticed when debugging one day that records would show up when using
the print command as though they'd been entered but hadn't actually
been written to the database. I'm hoping to find some sort of if/else
script that can be easily used with 'insert into' in my PHP. Am using
MySQL 4.1.11nt and PHP 5.04
A sample code I'm working on...
mysql_connect($ DBhost,$DBuser, $DBpass) or die("Unable to connect to
database"); // make connection to database
mysql_select_db ($DBName) or die("Unable to select database $DBName");
// select database
if (mysqli_connect _errno())
{
echo 'Error: Could not connect to database. Please report this
problem';
exit;
}
$sqlquery = "INSERT INTO $table VALUES('$id', '$money', '$treats',
'$date')";
$results = mysql_query($sq lquery);
mysql_close();
TIA for any help.
records entered into my form will actually be written to the database?
I noticed when debugging one day that records would show up when using
the print command as though they'd been entered but hadn't actually
been written to the database. I'm hoping to find some sort of if/else
script that can be easily used with 'insert into' in my PHP. Am using
MySQL 4.1.11nt and PHP 5.04
A sample code I'm working on...
mysql_connect($ DBhost,$DBuser, $DBpass) or die("Unable to connect to
database"); // make connection to database
mysql_select_db ($DBName) or die("Unable to select database $DBName");
// select database
if (mysqli_connect _errno())
{
echo 'Error: Could not connect to database. Please report this
problem';
exit;
}
$sqlquery = "INSERT INTO $table VALUES('$id', '$money', '$treats',
'$date')";
$results = mysql_query($sq lquery);
mysql_close();
TIA for any help.
Comment