Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-05-2005, 07:19 PM   #1 (permalink)
 
Junior Techie

Join Date: Apr 2003

Posts: 53

Magma

Send a message via AIM to Magma Send a message via Yahoo to Magma
Default Question

Im wondering how I can do this, I want to make a page which will call the DB and connect to it load the data.

for example


Page would show

User: SQL User
Active: SQL Yes/No
Email: SQL Email
UserID: SQL UserID

How would I go about making it so the SQL User etc. shows the value which is in the table?

This is what I learned so far..

so example would be

Include.php
Code:
<?
$username="Example";
$password="PasswordTest";
$database="new_db";
$table="tablename";
?>
then the code to call

page.php
Code:
<?
include("include.php");

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

$query="SELECT * FROM users";
$result=mysql_query($query);
$num=mysql_numrows($result); 
mysql_close();
?>
if the Table USERS had

User: SQL User
Active: SQL Yes/No
Email: SQL Email
UserID: SQL UserID

It should show up as

User: Test
Active: Yes
Email: Something@something.com
UserID: 1

Correct?
__________________
http://img165.imageshack.us/img165/8...r562600sj9.gif
CPU:AMD 3000+
RAM:1gb PC 3200
GFX:Nvidia FX5200 128mb
HDD:120gb 7200rpm, 200gb 7200rpm
OS:Windows XP Home SP1+2

Half-Life 2 Completed in Under 11 Hours
Magma is offline  
Old 02-06-2005, 08:07 PM   #2 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

Are you using a MySQL database or a SQL Server 2000 database? Because it makes a rather large difference.
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
Old 02-07-2005, 01:56 PM   #3 (permalink)
 
Junior Techie

Join Date: Apr 2003

Posts: 53

Magma

Send a message via AIM to Magma Send a message via Yahoo to Magma
Default

MySQL
__________________
http://img165.imageshack.us/img165/8...r562600sj9.gif
CPU:AMD 3000+
RAM:1gb PC 3200
GFX:Nvidia FX5200 128mb
HDD:120gb 7200rpm, 200gb 7200rpm
OS:Windows XP Home SP1+2

Half-Life 2 Completed in Under 11 Hours
Magma is offline  
Old 02-07-2005, 03:52 PM   #4 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

That looks correct to me, unless I'm missunderstanding what you're asking.
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
Old 02-09-2005, 11:38 AM   #5 (permalink)
 
Junior Techie

Join Date: Apr 2003

Posts: 53

Magma

Send a message via AIM to Magma Send a message via Yahoo to Magma
Default

thanks
__________________
http://img165.imageshack.us/img165/8...r562600sj9.gif
CPU:AMD 3000+
RAM:1gb PC 3200
GFX:Nvidia FX5200 128mb
HDD:120gb 7200rpm, 200gb 7200rpm
OS:Windows XP Home SP1+2

Half-Life 2 Completed in Under 11 Hours
Magma is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On