Jump to content

Create table


Casalen

Recommended Posts

I've never really used SQL. Right now I'm trying to install textual verification to PHPbb2. The script connects to the database, then tells me there's a syntax error in the following:

 

CREATE TABLE phpbb_textual_confirmation

(id INTEGER      NOT NULL AUTO_INCREMENT,

question TEXT    NOT NULL,

answers  TEXT    NOT NULL,

PRIMARY KEY (id)

);

INSERT INTO phpbb_textual_confirmation(question,answers) VALUES ('Are you human?', 'yes\nja\noui');

INSERT INTO phpbb_textual_confirmation(question,answers) VALUES ('Say hello', 'hello\nhi\nhallo');

 

Specifically, the first line. I've moved stuff around a bit in it to no avail, but I'm really not sure how this stuff is supposed to look yet.

Link to comment
https://forums.phpfreaks.com/topic/43901-create-table/
Share on other sites

If you are trying to execute those sql statement from a PHP script then you need to use mysql_query() to cal the sql code.

 

<?php
$sql = "CREATE TABLE phpbb_textual_confirmation
         (id INTEGER       NOT NULL AUTO_INCREMENT,
           question TEXT    NOT NULL,
           answers  TEXT    NOT NULL,
           PRIMARY KEY (id)
        )" ;
mysql_query($sql);

$sql = "INSERT INTO phpbb_textual_confirmation(question,answers) VALUES ('Are you human?', 'yes\nja\noui')";
mysql_query($sql);


$sql = "INSERT INTO phpbb_textual_confirmation(question,answers) VALUES ('Say hello', 'hello\nhi\nhallo')";
mysql_query($sql);

?>

Link to comment
https://forums.phpfreaks.com/topic/43901-create-table/#findComment-213142
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.