note 108487 rejected from function.mysql-num-rows by sp
| From: | sp@php.net | Date: | Wed, 02 May 2012 07:52:47 +0000 |
| Subject: | note 108487 rejected from function.mysql-num-rows by sp | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187430@lists.php.net to get a copy of this message | ||
Note Submitter: valerie dot danielsen at globalcrossing dot com
----
I'm new with PHP MYSQL. I've created a page that that links to an inventory database. What
I'm trying to do is sort tables by site name. I can achieve this manually but being we are
relocating devices from different sites from around the world We can easily update the inventory
however the site is hard coded in to to the web page. I need to query the site and seperate the
results by site without hard coding.
example I have 5 device in Eng1 and 10 in BKH7. All 5 devices will be moved to BKH7 which means I no
longer need to display Eng1 on my main page.
Right now I have seperate queries
$result1("SELECT * FROM devices WHERE site='Eng1'") ;
$result2("SELECT * FROM devices WHERE site='BKH7'");
ect...
Then I use the fetch array to return the values
<table>
while($row=mysql_fetch_array($result1)){
<tr>
<td>...</td>
</tr>
}
</table>
<table>
while($row=mysql_fetch_array($result2)){
<tr>
<td>....</td>
</tr>
}
</table>
Is there a way to do a foreach row return value that equals "site" so this way a table can
be created each time the site name changes?
Thank you for any help given!
</table>