Skip to content Skip to sidebar Skip to footer

Cannot Insert SQL Into One Specific Table

So I've been trying to insert sql into this one specific table for the past three hours and I think I'm starting to go insane. I've isolated things I think could be the problem, al

Solution 1:

Try thiS:

mysql_query($sql,$con) or die(mysql_error());

If there is a problem with the query (syntax error, or a key violation, etc...), then the die() call will spit out the error message describing the problem.


Solution 2:

Try

$sql = "INSERT INTO `FUideas` (`description`) VALUES ('HAI THAR')";

If that doesn't work then i ask, in your SQL to create the table, how come user and date are quoted, but the other fields aren't?


Solution 3:

Since it works as an admin, my guess is that the username you are using in the connection does not have insert privileges over the FUIdeas table.


Solution 4:

I am not exactly sure, but description may be reserved, try..

$con = mysql_connect('localhost', 'username', 'password');
mysql_select_db("my_db", $con);
$sql = "INSERT INTO `FUideas` (`description`) VALUES ('HAI THAR')";
mysql_query($sql,$con) or die(mysql_error());

I guess that would'nt make sense with the first one working...

is my_db the same for both instances?


Solution 5:

Can you see the SQL-error? I can't see how your first query works since you have a bunch of not null columns without DEFAULT-values.


Post a Comment for "Cannot Insert SQL Into One Specific Table"