...

View Full Version : myqsl database download of data to website page



jp12
03-28-2013, 08:53 PM
I'm trying to display data on a webpage that is relevant to that particular username. The only thing that would be completely unique for each row of data is the ID column.

Currently, I'm able to display the data from each row but it displays all of the rows due to a while loop.

while($rows=mysql_fetch_array($result)){
?>

Then the table code echos the $rows amd variables.

<?php
// close while loop
}
?>

How do I get this to only display data that is relevant for that particular username?

Old Pedant
03-28-2013, 09:30 PM
Change the SQL query. Which you didn't bother to show us, so I have no idea what it looks like.

knightCoder
03-29-2013, 03:07 AM
How do I get this to only display data that is relevant for that particular username?

If $result must contain data for more than 1 user, say for other purposes in your script, than you need an IF statement in your while loop that looks for the id of the user whose data you want to display.

Otherwise it would be simpler to retrieve from the db just the record you need to display using something like

select * from users where id=xxxxx where xxxxx is the user's id in the db.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum