Welcome to WebmasterWorld Guest from 54.226.23.160

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

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

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

Junior Member

5+ Year Member

joined:Feb 23, 2012
posts: 91
votes: 0


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();
?>
12:42 pm on Apr 18, 2012 (gmt 0)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 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)?
2:11 pm on Apr 18, 2012 (gmt 0)

Junior Member from IN 

10+ Year Member

joined:Nov 3, 2002
posts: 91
votes: 0


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

CREATE TABLE IF NOT EXISTS `forum_posts` (
9:12 pm on Apr 18, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Feb 23, 2012
posts: 91
votes: 0


EXCELLENT! That worked

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

Thanks, S
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members