Page 1 of 1

Php Code help?

Posted: Wed Apr 12, 2006 12:46 am
by mouncifb
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have a table wihtin an HTML page named usersdata.html and also have a mysql table in database that looks like this:

Code: Select all

----------------------------------
id username
----------------------------------
0 user1
1 user2
---------------------------------
the table within the HTML page stored in /var/www/html/usersdata.html

Code: Select all

<table>
<tr><th>Username</th><th>head1</th><th>head2</th><th>head3</th></tr>
<tr><td><a href="users.php?showuser=y&account=user1">user1</a></td><td>1269</td><td>0.00</td><td>0.00</tr></tr>
<tr><td><a href="users.php?showuser=y&account=user2">user2</a></td><td>338</td><td>12.49</td><td>10.64</tr></tr>
</table>

Question: How do I accomplish this by writing a PHP script that should look like this:


Code: Select all

<?php

loop fo each user in the mysql table {

while opening and searching through the file "userdata.html" {

match the first corresponding amount for the user ( example user1's amount is 0.00, user2's amount is: 12.49 as shown in the HTML table)
store the match (amount) in a variable "let's say $useramount"
store the variable $useramount in another table ( I can manage to do this myself, just to explain the purpose of doing this)


}


}

?>


Any help will be appreciated, thanks guys!!
mouncifb@yahoo.com


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Apr 12, 2006 5:06 am
by jito
will u pls show ur second database table structure, where u want to store the data?