Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
MYSQL QUERY PROBLEM WITH RESULTS
Old 05-23-2006, 06:55 PM MYSQL QUERY PROBLEM WITH RESULTS
Novice Talker

Posts: 7
Trades: 0
Hello i have made a query using dreamwever wizard(iam a novice) and when i upload my script it returns one of the users which is the first in the list and not the rest which i want to be able to display. The query is below which i put in a php file

<?php require_once('Connections/webmail.php');

mysql_select_db($database_webmail, $webmail);
$query_Recordset1 = "SELECT `username` , `password` FROM `hive_user` ORDER BY `username` ASC LIMIT 0 , 30";
$Recordset1 = mysql_query($query_Recordset1, $webmail) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

can anyone help me so that is returns all the users in a list rather than just one
Thankyou
jjwarr is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-23-2006, 07:38 PM Re: MYSQL QUERY PROBLEM WITH RESULTS
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
You need to create a loop and fetch a new row on each iteration

PHP Code:

require_once('Connections/webmail.php');

mysql_select_db($database_webmail$webmail);
$query_Recordset1 "SELECT `username` , `password` FROM `hive_user` ORDER BY `username` ASC LIMIT 0 , 30";

$Recordset1 mysql_query($query_Recordset1$webmail) or die(mysql_error());

$totalRows_Recordset1 mysql_num_rows($Recordset1);

// begin loop
while ( $row_Recordset1 mysql_fetch_assoc($Recordset1) ) { 
    echo 
$row_Recordset1['username']. "<br />"

Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 05-24-2006, 06:08 AM Re: MYSQL QUERY PROBLEM WITH RESULTS
Novice Talker

Posts: 7
Trades: 0
Hi thanks for the extra code it worked but only

// begin loop
while ( $row_Recordset1 = mysql_fetch_assoc($Recordset1) )
echo
$row_Recordset1['username']. "<br />"

with the end brackets which i took off sot hat brings up all users how do i bring up all the passwords next to them as well as users this is now the code with the added bit


<?php require_once('Connections/webmail.php');

mysql_select_db($database_webmail, $webmail);
$query_Recordset1 = "SELECT `username` , `password` FROM `hive_user` ORDER BY `username` ASC LIMIT 0 , 30";

$Recordset1 = mysql_query($query_Recordset1, $webmail) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

// begin loop
while ( $row_Recordset1 = mysql_fetch_assoc($Recordset1) )
echo $row_Recordset1['username']. "<br />"



?>
thankyou

jjwarr is offline
Reply With Quote
View Public Profile
 
Old 05-24-2006, 08:07 AM Re: MYSQL QUERY PROBLEM WITH RESULTS
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
To show the password, just concatnate the two columns in the output

PHP Code:
while ( $row_Recordset1 mysql_fetch_assoc($Recordset1) )
    echo 
$row_Recordset1['username']. " -- " $row_Recordset1['password']. "<br />" 
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 05-26-2006, 04:01 PM Re: MYSQL QUERY PROBLEM WITH RESULTS
Novice Talker

Posts: 7
Trades: 0
Thankyou
that fixed the problem
jjwarr is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to MYSQL QUERY PROBLEM WITH RESULTS
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15491 seconds with 12 queries