Ok, maybe I thought this would be something easily answered at the beginning...but since I left out a tad bit of info, it made it worse I guess (sorry 🙁 ).
Here is the actual code I am using right now (or trying) with your code incorporated a bit NogDog.
function viewEventDetails($eventID){
echo "<table>\n";
foreach(viewEventConfirmation($eventID, '') as $row)
{
echo "<tr>";
foreach($row as $value)
{
echo "<td>$value</td>";
}
echo "</tr>\n";
}
echo "</table>\n";
}
function viewEventConfirmation($eventID, $userID){
//no userID is set so we pull all records for a specific eventID
if(!isset($userID)){
$sql = "SELECT * FROM events_confirmed WHERE event_id = '$eventID' AND user_id != '0'";
}else{
//both vars are set, so we just use them and get specific event and see if user is confirmed for it
$sql = "SELECT * FROM events_confirmed WHERE event_id = '$eventID' AND user_id = '$userID'";
}
$result = db_query($sql); //db_query does query
$output = array();
while($row = mysql_fetch_assoc($result))
{
$output[] = $row;
}
return($output);
}
//let's call it out
viewEventDetails($id);
Now this is not exactly how I am going to use it. The echo for the table and stuff will be done in a different way...but this is essentially it (not leaving out any important info now hehe).
I am wondering if it would be easier to write up a class.