1989gta Posted November 29, 2007 Share Posted November 29, 2007 I’m running into a problem when writing my page what I want is to run a query that will pull a list of application names, echo the first application name in the query. The next query will run using that application name pull a count and then echo the count to the page then loop and start all over again with the next app and count. For some reason I can’t get it to work. <? echo "<table border=1>"; echo "<tr>"; echo "<td>Application</td>"; echo "<td bgcolor=#f8f3df>Todays Totals</td>"; echo "</tr>"; ///////////////////////////////////application///////////////////////////////// $query = "SELECT app_name,install_date FROM tbl where app_name <> ''"; $result = mssql_query ($query); while($line = mssql_fetch_array($result)){ echo "<tr border=1>"; $app =$line[0]; /////////////////////////////////////todays totals///////////////////////////// ////////////////////////////////////pull current date////////////////////////// $current_date = date('m-d-y'); $query = "select count(*) from conversions where date_current ='$current_date' and package_name='$app'"; $result = mssql_query ($query); while($line = mssql_fetch_array($result)){ $todays_count = $line[0]; $test = explode(",","$app"); for ($i=0; $i < Count($test); $i++) { echo "<td nowrap>"; echo"$test[$i]"; echo "</td>"; } } } echo "</tr>"; echo "</table>"; ?> With this I’m just trying to echo all the application names but as soon as I add the explode and loop it only echos the first app so i'm lost. Link to comment https://forums.phpfreaks.com/topic/79466-for-loop-and-explode-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.