bigdog619sd
MIS
- Aug 12, 2002
- 11
Hello, I am trying to pull DISTINCT data from a MySQL DataBase and feed it into a php array.
Here is the query.
$DistinctServersFromDB = "SELECT DISTINCT Name FROM Server_Monitor ";
$result4 = mysql_query($DistinctServersFromDB) or die ("Query failed: " . mysql_error());
for ($i = mysql_num_rows($result4) - 1; $i >= 0; $i--) {
if (!mysql_data_seek($result4, $i)) {
echo "Cannot seek to row $i: " . mysql_error() . "\n"; continue ; }
if(!($row = mysql_fetch_object($result4))) continue ;
$q4Name = $row->Name ;
echo " $q4Name <br> " ; }
How can I get the data from this query into an array ?
If there is a more elegant way to do this please let me know.
Thanks for all your help...
dhaynes
Here is the query.
$DistinctServersFromDB = "SELECT DISTINCT Name FROM Server_Monitor ";
$result4 = mysql_query($DistinctServersFromDB) or die ("Query failed: " . mysql_error());
for ($i = mysql_num_rows($result4) - 1; $i >= 0; $i--) {
if (!mysql_data_seek($result4, $i)) {
echo "Cannot seek to row $i: " . mysql_error() . "\n"; continue ; }
if(!($row = mysql_fetch_object($result4))) continue ;
$q4Name = $row->Name ;
echo " $q4Name <br> " ; }
How can I get the data from this query into an array ?
If there is a more elegant way to do this please let me know.
Thanks for all your help...
dhaynes