I absolutely hate arrays. I try to avoid them in all code I write (which I know is awful), so imagine my dismay when I realized I needed a 2D array!
What I need to do is calculate the horses total score (with info coming from a table) then store that total with its corresponding horseID in an array so that I can sort them (to place them--like a show) and then store their place in a different table. I don't even know where to start!
This is what I have so far...
Code: Select all
$q="SELECT COUNT(*), horseID FROM enteredHorses WHERE showID='$showid'";
$r = mysqli_query ($dbc, $q) or trigger_error(mysqli_error($dbc));
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
$numHorses = $row['COUNT(*)'];
$horseID = $row['horseID'];
if ($showType == 'DRES' || 'HUNT') {
$total = dresHunt($horseID);
if ($total == FALSE){
echo 'Something went wrong. Please contact an administrator.';
include ('includes/footer01.html');
exit();
}
}
if ($showType == 'SJ' || 'CC') {
$total = SjCC($horseID);
if ($total == FALSE){
echo 'Something went wrong. Please contact an administrator.';
include ('includes/footer01.html');
exit();
}
}
if ($showType == 'EQ') {
$total = detEq($horseID);
if ($total == FALSE){
echo 'Something went wrong. Please contact an administrator.';
include ('includes/footer01.html');
exit();
}
}
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: