Urgent!
hi all i am trying to use data from 4 tables in a single database and use the data to calculate a total value and compare that total value with the minimum value(minimum mark set in the database) and display the name,registration number,first university choice and first field choice in a table form.
here is my php code
enter code here
<?php
Database connection details
$username = "root";
$password = "";
$hostname = "localhost";
connect to database
mysql_connect($hostname,$username,$password);
mysql_select_db("people");
Construct join query and select data
$result = mysql_query("SELECT
selectuniversity.reg_No,
selectuniversity.choice_1,
selectuniversity.choice_2,
selectuniversity.choice_3,
selectuniversity.choice_4,
selectuniversity.choice_5,
fieldselect.choice_1,
fieldselect.choice_2,
fieldselect.choice_3,
fieldselect.choice_4,
fieldselect.choice_5,
fieldselect.reg_No,
placementsetting.Averagetranscript,
placementsetting.entrance,
placementsetting.Entranceresult,
placementsetting.female_mrk,
placementsetting.Field,
placementsetting.max_mark,
placementsetting.min_mark,
placementsetting.sex,
placementsetting.transcript,
placementsetting.region_mark,
placementsetting.name,
placementsetting.reg_No,
users.avg_transscript,
users.reg_No,
users.disability,
users.RegDevStatus,
FROM selectuniversity,fieldselect,placementsetting ,users
WHERE selectuniversity.reg_No = fieldselect.reg_No = placementsetting.reg_No = users.reg_No
ORDER BY users.reg_No ASC")
or die(mysql_error());
/$tranpercent= $row['transcript']
$entrpercent= $row['entrance']
$sex=$row['sex']
$regionMark=$row['region_mark']
$maxmrk=$row['max_mark']
$minMark=$row['min_mark']
$regNo_=$row['reg_No']
$fmlemrk=$row['female_mark']
$avgTrans=$row['Averagetranscript']
$EntrResult=$row['Entranceresult']
$disablity=$row['disability']
$choice1=$row['choice_1']
$RgDev=$row['RegDevStatus']
$stName=$row['name'] /
// if sex is female total= female mark + ......
if($sex = $row['Female']){
$total = ($row['female_mark'] + $row['transcript'] $row['Averagetranscript'] + $row['entrance'] $row['Entranceresult'])/100
}
//if regions development status is total= region mark + ......
if($RgDev = $row['Developing']{
$total = ($row['region_mark'] + $row['transcript']* $row['Averagetranscript'] + $row['entrance']* $row['Entranceresult'])/100
}
//if(mysql_num_rows($result))
//{
/if total >= minimark set, then display name, regstration no_, first university choice and first field choice in a table /
echo "<table border="0" >";
echo "<tr> ";
while(mysql_fetch_row($result)
{
if($total>= $minMark){
echo "<td>< $row['name']";
echo "<td>< $row['reg_No']";
echo "<td>< $row_selectuniversity['choice_1']";
echo "<td>< $row_ fieldselect['choice_1']";
echo "</tr>";
}
else
{
echo "you have no enough mark to have this field you will be assigned by the MOE";
}
mysql_close();
?>
I greatly appreciate any one who help me do this