Is there a better way? mssql
Posted: Wed Jan 13, 2010 11:22 pm
I'm trying to have one query populate what will eventually be multiple input list. Right now I'm just cycling through the arrays. I want each list to be filtered differently based on the ITEM_SRC field.
I feel there has to be a better way to do this. Thoughts?
I feel there has to be a better way to do this. Thoughts?
Code: Select all
$query = "SELECT ITEM_SRC, ITEM_ID, ITEM_DESC ";
$query .= "FROM vWEB_LIST ";
//execute the SQL query and return records
$result = mssql_query($query);
//Return AD_SIZE list
while($row = mssql_fetch_array($result))
{
if($row[0]=='AD_SIZE')
{
echo $row['ITEM_SRC']." - ".$row['ITEM_ID']." - ".$row['ITEM_DESC']."<br>";
}
}
mssql_data_seek($result,0);
while($row = mssql_fetch_array($result))
{
echo $row['ITEM_SRC']." - ".$row['ITEM_ID']." - ".$row['ITEM_DESC']."<br>";
}