开发者

PHPbb DBAL refuses to Execute Correct PHP and SQL

开发者 https://www.devze.com 2023-03-17 09:00 出处:网络
chances are if you are seeing this you most likely saw my last question. So from there I have made progress. I have realized that the SQL is fine and that it is the PHPbb\'s DBAL that is causing开发者

chances are if you are seeing this you most likely saw my last question.

So from there I have made progress. I have realized that the SQL is fine and that it is the PHPbb's DBAL that is causing开发者_如何学JAVA problems. I sould also note that I am using usercake which initiates the dbal class and all that. For some reason the following code works:

$sql = "CREATE TABLE ideas(
id int(10) unsigned NOT NULL auto_increment,
`user` tinytext NOT NULL,
`date` int(10) unsigned NOT NULL default '0',
description text NOT NULL,
upvotes text NOT NULL,
downvotes text NOT NULL,
appreciated tinyint unsigned NOT NULL default '0',
ip tinytext NOT NULL,
PRIMARY KEY  (id))";
$temp = $db->sql_query($sql);
die($temp);

But this code doesn't:

$sql = "INSERT INTO `FUideas` (`description`) VALUES ('TESTER')";
$temp = $db->sql_query($sql);
die($temp);

For information on the FUideas table see my previous post.

I know the sql works because it executes if I use plain php:

$con = mysql_connect('localhost', 'name', 'password');
mysql_select_db("db", $con);
$sql = "INSERT INTO `concepts` (`description`) VALUES ('TESTER')";
mysql_query($sql,$con) or die(mysql_error());

Any ways to fix this are much appreciated

If you need any more information just ask, also I will be online, so if you want to attempt a test just post the code and I will try it.

Edit

So I get it to work if I fill out the other fields with either a 0 or '', can anyone explain this behavior?


It seems as though you're creating a table named ideas and then trying to inser into a table named FUideas. Has FUideas been created elsewhere? In any case, try die(mysql_error()); to see if the error is with the query itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消