Jump to content

Archived

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

Linux_BSD_Unix

Help with phpMyAdmin please

Recommended Posts

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 phpMyAdmin

i created a database in my admin CP and a username & password for that database in my admin CP.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
All you need do is follow AndyB's instructions. This will build your database tables.

Share this post


Link to post
Share on other sites
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 5

Warning: 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 7

Warning: 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 7

Warning: mysql_query() [function.mysql-query]: Access denied for user: 'nobody@localhost' (Using password: NO) in /home2/linuxmf/public_html/phpBulletin/index.php on line 6

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home2/linuxmf/public_html/phpBulletin/index.php on line 6
Access 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_phpBulletin

and 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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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_phpBulletin

The username I created for it was: linuxmf_php1


Also, 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?

Share this post


Link to post
Share on other sites
Wrong forum.

Hmmm, I wonder why the mods that have been replying haven't moved it to 3rd party scripts.

Share this post


Link to post
Share on other sites
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 5
I 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.

Share this post


Link to post
Share on other sites
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.php
viewthread.php
addthread.php
addreply.php

Those work, but these don't
index.php
Notihng for database.php comes up

and I made a new folder called "admin" for these:
add_forum.php
add_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 3

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 3

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 3

Warning: 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.

Share this post


Link to post
Share on other sites

×

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.