Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

60 users online



displaying rows

displaying rows

Currently viewing this thread: 1 (0 members and 1 guests)


d4nny

d4nny

Status: Offline!

displaying rows

i made a login script and when the user log's in i would like it to display the information in their row in the mysql table... however when they log in my code is displaying all info in every table... im sure its a simple mess up... can anyone help?

PHP:


<?php

$connection 
mysql_connect("localhost""dbuser""dbpass") or die 

(
"Unable to connect!");

mysql_select_db("dbname") or die ("Unable to select database!");

$query "SELECT * FROM user";
$result mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

while (
$row mysql_fetch_row($result))
{
    echo 
"$row[1] - $row[2]\n";
};

mysql_close($connection);

?>

___________________

http://www.viewgasm.com/images/vgbanner.gif

inigoesdr

inigoesdr

Status: Offline!

Change this:

PHP:

<?php
while ($row mysql_fetch_row($result))
{
    echo 
"$row[1] - $row[2]\n";
};
?>


To the row's field names:

PHP:

<?php
while ($row mysql_fetch_row($result))
{
    echo 
"$row['name']<br />\n";
    echo 
"$row['user']<br />\n";
    echo 
"$row['favitem']<br />\n";
};
?>


Where name, user, & faveitem are fields in your table Smile

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.007 seconds.