Linux_BSD_Unix Posted September 30, 2006 Share Posted September 30, 2006 Hi, I need help using phpMyAdmin. I am using a tutorial to create my own forum software written in php & MySQL, a simple forum. I nee dhelp creating these in phpMyAdmin for my forum: [code] The Categories Table: Our id is the primary key and has a max number of 9,999 (4 characters). The Id will auto increment (+1) everytime a new row is inserted into this table. The title and description have a max character length of 255. create table categories( id int(4) not null auto_increment, title varchar(255) not null, description varchar(255) not null, primary key(id) ); The Forums Table: More complex than the categories table, this has a main id, and cid which will be used to define our 'category id'. Primary key is id. The other columns should be self-explained by now (nothing new introced since the previous table). create table forums( id int(4) not null auto_increment, cid int(4) not null, title varchar(255) not null, description longtext not null, last_post_title varchar(255) not null, last_post_username varchar(32) not null, topics int(9) not null, replies int(9) not null, primary key(id) ); The Topics Table: This next one is longer, but still basic. Take note of the timestamp column. This will be used to define what threads are newest (to show first when being listed). create table topics( id int(9) not null auto_increment, timestamp int(20) not null, fid int(4) not null, title varchar(255) not null, post longtext not null, username varchar(32) not null, last_post_username varchar(32) not null, replies int(9) not null, views int(9) not null, primary key(id) ); The Replies Table: A much simplified version of the 'topics' table, nothing unordinary. create table replies( id int(9) not null auto_increment, tid int(9) not null, post longtext not null, username varchar(32) not null, primary key(id) ); [/code] Can someone here help me do this in phpMyAdmini created a database in my admin CP and a username & password for that database in my admin CP. Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 30, 2006 Share Posted September 30, 2006 Assuming that you have also created the necessary permissions for that user to access that database ... start phpMyAdmin. Choose your database from the dropdown at left. Click the SQL link/button at the top and you'll see a text box appear.Paste the table definition for your first table there and hit the 'GO' button. That creates the table. Continue until all tables have been created. Quote Link to comment Share on other sites More sharing options...
Linux_BSD_Unix Posted October 1, 2006 Author Share Posted October 1, 2006 Ok. I beleive the user I created has the privagle to "All" I tihnk. Okay, thanks.Ok, I created them now do I export them and upload them? if so, do I have to upload them to a certain folder or jsut the main directory of the forum? Quote Link to comment Share on other sites More sharing options...
trq Posted October 1, 2006 Share Posted October 1, 2006 All you need do is follow AndyB's instructions. This will build your database tables. Quote Link to comment Share on other sites More sharing options...
Linux_BSD_Unix Posted October 1, 2006 Author Share Posted October 1, 2006 I used phpMyAdmin, like you said and created the tables and stuff....but now i got this error when trying to view the forum:[code] Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'username@localhost' (Using password: YES) in /home2/linuxmf/public_html/phpBulletin/database.php on line 5Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user: 'nobody@localhost' (Using password: NO) in /home2/linuxmf/public_html/phpBulletin/database.php on line 7Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home2/linuxmf/public_html/phpBulletin/database.php on line 7Warning: mysql_query() [function.mysql-query]: Access denied for user: 'nobody@localhost' (Using password: NO) in /home2/linuxmf/public_html/phpBulletin/index.php on line 6Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home2/linuxmf/public_html/phpBulletin/index.php on line 6Access denied for user: 'nobody@localhost' (Using password: NO)[/code] I uploaded the .sql file in the forums main directory. But in my sites admin cp I have this as a MySQL database I made: linuxmf_phpBulletinand then the username I made was: linuxmf_php1 and gave it all privlagives.What do I do now? Thisis the tutorial I'm using: http://www.tutorialized.com/tutorial/Basic-Forum/13149 Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 1, 2006 Share Posted October 1, 2006 From the MySQL page of Cpanel, did you [b]add user to db[/b] after you had selected the privileges you wanted?If that isn't what you missed, then post some of the code you use for database.php (x out the password when you post here). Quote Link to comment Share on other sites More sharing options...
Linux_BSD_Unix Posted October 1, 2006 Author Share Posted October 1, 2006 Yea I have added a username and password. Okay I'll do that. :)[b]database.php[/b][code] <? // 1st expression is the server, usually "localhost" // 2nd expr. is the username // 3rd expr. is the password mysql_connect("localhost", "username", "password"); // this one defines our database name. mysql_select_db("database"); ?> [/code] The database I made in MySQL of the CP is: linuxmf_phpBulletinThe username I created for it was: linuxmf_php1Also, under the database in MySQL of the CP it says this, besides PHP I wonder if I just replace it with the code in dtabase.php: $dbh=mysql_connect ("localhost", "linuxmf_php1", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("linuxmf_phpBulletin"); would I use that and replace it over mysql_connect("localhost", "username", "password"); // this one defines our database name. mysql_select_db("database"); that part of dtatbase.php file? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted October 1, 2006 Share Posted October 1, 2006 Wrong forum.Hmmm, I wonder why the mods that have been replying haven't moved it to 3rd party scripts. Quote Link to comment Share on other sites More sharing options...
Linux_BSD_Unix Posted October 1, 2006 Author Share Posted October 1, 2006 When I replaced that code whith that new one I listed I get this error: [code] Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'linuxmf_php1@localhost' (Using password: YES) in /home2/linuxmf/public_html/phpBulletin/database.php on line 5I cannot connect to the database because: Access denied for user: 'linuxmf_php1@localhost' (Using password: YES)[/code] Oh, I'm sorry that its in the wrong forum. I didn't realize. It should be moved then. Quote Link to comment Share on other sites More sharing options...
Linux_BSD_Unix Posted October 1, 2006 Author Share Posted October 1, 2006 I tihnk I fixed it. What do you think?http://www.linux.mfhosting.com/phpBulletin/But the index.php file, notihng comes up, but when you try the viewforum.phpviewthread.phpaddthread.phpaddreply.phpThose work, but these don'tindex.phpNotihng for database.php comes upand I made a new folder called "admin" for these:add_forum.phpadd_catagory.php But I get these errors for add_catagory.php: [code]Warning: main(database.php) [function.main]: failed to open stream: No such file or directory in /home2/linuxmf/public_html/phpBulletin/admin/add_category.php on line 3Warning: main(database.php) [function.main]: failed to open stream: No such file or directory in /home2/linuxmf/public_html/phpBulletin/admin/add_category.php on line 3Warning: main(database.php) [function.main]: failed to open stream: No such file or directory in /home2/linuxmf/public_html/phpBulletin/admin/add_category.php on line 3Warning: main() [function.include]: Failed opening 'database.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/linuxmf/public_html/phpBulletin/admin/add_category.php on line 3[/code] and add_forum.php won't even open in my browswer. http://www.linux.mfhosting.com/phpBulletin/ is the forums main URL to access the other forum files. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.