Jump to content


Photo

Help with phpMyAdmin please


  • Please log in to reply
9 replies to this topic

#1 Linux_BSD_Unix

Linux_BSD_Unix
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 30 September 2006 - 08:07 PM

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:


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) 
);  



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.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 30 September 2006 - 08:22 PM

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.
Legend has it that reading the manual never killed anyone.
My site

#3 Linux_BSD_Unix

Linux_BSD_Unix
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 01 October 2006 - 04:21 AM

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?

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 01 October 2006 - 05:04 AM

All you need do is follow AndyB's instructions. This will build your database tables.

#5 Linux_BSD_Unix

Linux_BSD_Unix
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 01 October 2006 - 05:19 AM

I used phpMyAdmin, like you said and created the tables and stuff....but now i got this error when trying to view the forum:


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)



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.tutoriali...sic-Forum/13149


#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 01 October 2006 - 12:26 PM

From the MySQL page of Cpanel, did you add user to db 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).
Legend has it that reading the manual never killed anyone.
My site

#7 Linux_BSD_Unix

Linux_BSD_Unix
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 01 October 2006 - 01:27 PM

Yea I have added a username and password. Okay I'll do that. :)
database.php

<? 
// 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"); 
?> 



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?



#8 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 01 October 2006 - 03:36 PM

Wrong forum.

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

#9 Linux_BSD_Unix

Linux_BSD_Unix
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 01 October 2006 - 03:37 PM

When I replaced that code whith that new one I listed I get this error:


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)



Oh, I'm sorry that its in the wrong forum. I didn't realize. It should be moved then.

#10 Linux_BSD_Unix

Linux_BSD_Unix
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 01 October 2006 - 04:13 PM

I tihnk I fixed it. What do you think?

http://www.linux.mfh...om/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:

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


and add_forum.php won't even open in my browswer.

http://www.linux.mfh...om/phpBulletin/ is the forums main URL to access the other forum files.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users