Someone please help me with the reason as to why this is not working. i am checking if a record exists with count. if it exits no add new, if it does not add new allowed.
<?php
// Setting a value for the new week to be added
$TeamOwner = $teams->MemberID->CurrentValue;
$OldWeek = $teams->WeekID->CurrentValue;
$NewWeek = ($OldWeek+1);
echo $NewWeek;
$con=mysqli_connect("localhost","root","","soccer_team");
// Check connection
if (mysqli_connect_errno())
{
throw new Exception(mysqli_connect_error(), mysqli_connect_errno());
getPosts($con); "Please try again later: " . mysqli_connect_error();
} else {
$result = mysqli_query($con,"SELECT COUNT(*) c FROM teams WHERE MemberID= $TeamOwner AND WeekID= $NewWeek");
$row = mysqli_fetch_array($result);
$row = $result->fetch_row();
$total = $row[0];
echo "No of Teams created this week: " . $total;
mysqli_close($con);
}
switch ($total)
{
case ($total== 0):
?><script> document.getElementById('btnAction').disabled = true; </script><?php
break;
case ($total == 1):
echo 'You cannot create another team, please update your existing team';
break;
}
?>
OO
&Procedural
stylemysqli_fetch_array
&fetch_row
?