Forum Moderators: coopster

Message Too Old, No Replies

CREATE TABLE forum posts - Conn OK, but no table created

         

Scotty13

6:47 am on Apr 18, 2012 (gmt 0)

10+ Year Member



Just cant see what's missing. Thanks in advance.

<?php

require_once "connect_to_mysql.php";

print "Success in database CONNECTION.....<br />";

$result = "CREATE TABLE forum_posts (
id int(11) NOT NULL AUTO_INCREMENT,
post_author varchar(24) NOT NULL,
post_author_id int(11) NOT NULL,
otid int(11) NOT NULL,
date_time datetime NOT NULL default '0000-00-00 00:00:00',
type enum('a','b') NOT NULL default 'a',
view_count int(11) NOT NULL,
section_title varchar(88) NOT NULL,
section_id int(11) NOT NULL,
thread_title varchar(64) NOT NULL,
post_body text NULL,
closed enum('0','1') NOT NULL default '0',
PRIMARY KEY (id)
) ";
if (mysql_query($result)){
print "Success in TABLE creation!......
<br /><br /><b>That completes the table setup, now delete the file <br />
named 'section.php' and you are ready to move on. Let us go!</b>";
} else {
print "no TABLE created. You have problems in the system already, backtrack and debug!";
echo "\n" . mysql_error();
}
exit();
?>

eelixduppy

12:42 pm on Apr 18, 2012 (gmt 0)



1) Are you getting any errors from this query from calling mysql_error()?

2) What is your intention by creating a table via a script such as this, instead of already having the table made in the first place (via a manual action in the db)?

chrisranjana

2:11 pm on Apr 18, 2012 (gmt 0)

10+ Year Member



Check whether the table has already been created or you can use this sql

CREATE TABLE IF NOT EXISTS `forum_posts` (

Scotty13

9:12 pm on Apr 18, 2012 (gmt 0)

10+ Year Member



EXCELLENT! That worked

I’m following a tutorial online and this is his forum to add to my website.

Thanks, S