Search
Left Quote    Every day I get up and look through the Forbes list of the richest people in America. If I
- Robert Orben    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Create members table in database
  This user is online  Guest
  Subject: " Create members table in database" Posted: @ 6:48 pm on Oct 15 2005   
Unregistered
Hi,
I am not sure exactly where in the phpMyAdmin I am supposed to create this table. I am just trying to create a members system and have ABSOLUTELY NO IDEA how to do it. I am a complete newbie to this, but I do learn fast. I just need some more directions.
Can someone help me?

    Viewed: 17,233 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Create members table in databa..." Posted: @ 8:17 pm on Oct 15 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

bring up phpMyAdmin

from the top of the menu to the left, click "SQL&quo t;. This will open a window. You'll see a box that has something like:
"SELECT * FROM WHERE 1" --> Delete that text where the box is now blank.

paste in this code:

Code:


CREATE TABLE `members` (
`user_id` mediumint(8) NOT NULL auto_increment,
`username` varchar(25) NOT NULL default '',
`user_password` varchar(32) NOT NULL default '',
`user_email` varchar(255) NOT NULL default '',
PRIMARY KEY (`user_id`)
) TYPE=MyISAM AUTO_INCREMENT= 60 ;



this is the SQL (structured query language) that will create the members table. After you paste, hit the "GO" ; button to the bottom right of the box.

this should create your table.




-bs0d | AllSyntax.com

    Viewed: 17,226 Times | Reply to This | To top
  This user is offline  snatchsquad
  Subject: "re: Create members table in databa..." Posted: @ 11:11 am on Oct 25 2005    
Member #: 95
Rank: User - (6)
Since: 10/25/05
Posts: 6

Ok. Once the code is entered and I created the database. How do I set it up so my web page will access with usernames and passwords... I remember seeing a code for this, but might have disappeared when the site went off line for a couple days.




free 10 minutes midnighttreats. com use passcode: treatme

    Viewed: 17,202 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Create members table in databa..." Posted: @ 1:14 pm on Oct 25 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA




-bs0d | AllSyntax.com

    Viewed: 17,194 Times | Reply to This | To top
  This user is offline  snatchsquad
  Subject: "re: Create members table in databa..." Posted: @ 2:01 am on Oct 26 2005    
Member #: 95
Rank: User - (6)
Since: 10/25/05
Posts: 6

I guess my real problem is how to make the database connection. I know that you have to use a source code, but I am not sure how I do this or where I put it. I went to the database connection page, but it is pretty brief and over my head. Thanks for helping me by the way!!




free 10 minutes midnighttreats. com use passcode: treatme

    Viewed: 17,184 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Create members table in databa..." Posted: @ 2:39 pm on Oct 26 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

this is how you can connect to the database. The inital connection is made with the mysql_connect() ; function, then selected by the mysql_select_db (); function. To make it simpler (in this code sample), variables are set for each parameter (database host, database username and pass, ect).

each time you wish to interact with the database, this code must be executed (makes the connection). You cannot query any data unless you are connected, so - thats why some just put this code in a file, and call upon it when they need to connect.

When you're connected, you can query the database for whatever you need, or execute functions to insert or delete data. Remember the "Introduction to SQL " tutorial, read up on that.

anything else, just ask.

Code:


<?php

$database[dbser ver]="db_ host.com" ;
$database[dbuse r]="db_us er";
$database[dbnam e]="datab ase_name" ;
$database[dbpas s]="db_us er_pass";
$table ="table1 ";

$connect = mysql_connect($ database['dbse rver'], $database['dbu ser'], $database['dbp ass']);

$select= mysql_select_db ($database['db name']);
?>



Edited at 02:40:53 pm on 10/26/05


-bs0d | AllSyntax.com

    Viewed: 17,167 Times | Reply to This | To top
  This user is offline  snatchsquad
  Subject: "re: Create members table in databa..." Posted: @ 1:46 am on Oct 29 2005    
Member #: 95
Rank: User - (6)
Since: 10/25/05
Posts: 6

But where do I put that code... In my html? Somewhere in my webshell?




free 10 minutes midnighttreats. com use passcode: treatme

    Viewed: 17,143 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Create members table in databa..." Posted: @ 3:20 am on Oct 29 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Ok, whatever file you have, name it with a .php extension. If your file is index.html, rename it to index.php so the server side code is executed.

if it is a php file, html code will be executed as regularly, but when the browser comes across the php code, it is executed by the server and output to the browser as html.




-bs0d | AllSyntax.com

    Viewed: 17,140 Times | Reply to This | To top
  This user is offline  snatchsquad
  Subject: "re: Create members table in databa..." Posted: @ 7:26 pm on Oct 29 2005    
Member #: 95
Rank: User - (6)
Since: 10/25/05
Posts: 6

Hi, I think I am close to understanding this...
my page is http://snatchsq uad.com/officer sclub.htm
I need to change it to a .php, which I understand. When I put the code you gave me in the html on frontpage, it just shows up on the page as text. What am I doing wrong.




free 10 minutes midnighttreats. com use passcode: treatme

    Viewed: 17,132 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Create members table in databa..." Posted: @ 7:49 pm on Oct 29 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

yes, make your file name "officers club.php"

and when you want php code to be executed, start off with <? //php code in here, and end with ?> just like that. Also, make sure your host supports PHP. If your host does not support PHP on their servers, it would likely just show up as text.




-bs0d | AllSyntax.com

    Viewed: 17,129 Times | Reply to This | To top
  This user is offline  snatchsquad
  Subject: "re: Create members table in databa..." Posted: @ 12:22 pm on Nov 02 2005    
Member #: 95
Rank: User - (6)
Since: 10/25/05
Posts: 6

So what are my options if my host doesn't support PHP? Do you know of code for html that will perform the same task?




free 10 minutes midnighttreats. com use passcode: treatme

    Viewed: 17,105 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Create members table in databa..." Posted: @ 1:12 pm on Nov 02 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

no, thats the thing about php. Its a server side language that allows you to create dynamic webpages. With HTML, you can only create static webpages.

Search google, I think Lycos offers free PHP web hosting.




-bs0d | AllSyntax.com

    Viewed: 17,099 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank