I understand this is a frequently asked question, but I'm having trouble with this before. I've written quite a few sql statements that write to database, so I am not sure why this is happening. My code says the record has been written, but the record doesn't show up in my database in phpmyadmin. Here is my code:
$hostname = "localhost";
$dbusername = "username";
$dbname = "database";
$dbpassword = "password";
mysql_connect($hostname, $dbusername, $dbpassword) OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db($dbname);
$sql = "INSERT INTO 'payment_profiles'(id, client_id) VALUES ( '','$profile_id')";
mysql_query($sql);
if(! $sql )
{
die('Could not enter data: ' . mysql_error());
}
else {
echo ("We inserted the id");
}
It tells me "We inserted the id" when the script is ran, so I am not sure what the problem is. Maybe someone has seen this before? Note: the profile_id variable is declared higher up in my script, its just not on here.