結果のデータをテーブルに出力するクエリがあります。if
そのテーブルには、このステートメントに不可欠な2つのフィールドがあります:Max Capacity
とCurrent Capacity
。これらは、同じテーブルのデータベースからのものです。
if
私はステートメントを書きたいです:
if (Max_C == Current_C){
echo "Sorry, course is full.";
}
else{
$insert = mysql_query ("insert into blahblahblah... ");
}
どうすればよいですか?max_c
とcurrent_c
をデータベースから指定するにはどうすればよいですか?
コードのそのセクション:
if($courseandtime) { $max_e = $courseandtime['MaxEnrollment']; $current_e = $courseandtime['COUNT(REGISTERED.SID)']; }
if ($current_e < $max_e) {
echo "
<form action='register-exec.php' method='post'>
<label>Time: $_POST[Time]</label><br>
<input type='hidden' value='$Time' /><br><br>
<label>Student ID:</label><br>
<input type='text' name='SUCID' id='SUCID' /><br><br>
<label>CID: $_POST[CID]</label><br>
<input type='hidden' name='CID' id='CID' /><br><br>
<label>SID: $row['SID']</label><br>
<input type='hidden' name='SID' id='SID' /><br><br>
<button type='submit'>Register</button>
</form>
";
}
else {
echo 'Sorry, were full!';
}