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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.