$cat_query = mysql_query("SELECT * from news_categories");
$story_html = '';
while($row_cat = mysql_fetch_array($cat_query)){
is just a simple query and array loop.
I want to be able to change this based on an if statement.
if($x==1){
$cat_query = mysql_query("SELECT * from news_categories");
$story_html = '';
while($row_cat = mysql_fetch_array($cat_query)){
}
else
{
$blah = explode(":",$variable);
foreach($blah as $blah)){
}
You can see how the IF statement curly brace interefere with the while loop and the foreach loops. I can't get my head around how to do this. I don't want to have to reproduce the code in between the while statement twice one for the while and one for the foreach.
thanks