Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[Help] Php mysql (pageant tabulation)

Status
Not open for further replies.

zell_rey

Novice
Advanced Member
Messages
40
Reaction score
1
Points
28
Masave xa sa tblproduction pero hindi xa masave sa tblreportproduction.
see attached file..

this is the code for process
<?php
session_start();
include 'includes/connection.php';

$contestantimage = $_POST['contestantimage'];

$sql = "SELECT * FROM tblcontestant WHERE Image = '$contestantimage'";
$query = mysql_query($sql);
while ($row=mysql_fetch_array($query))
{
$contestantno = $row['ContestantNo'];
}

$nextcontestant = $contestantno + 1;

$sqlimage = "SELECT * FROM tblcontestant WHERE ContestantNo = '$nextcontestant' ";
$imagequery = mysql_query($sqlimage);
while ($imagerow = mysql_fetch_array($imagequery))
{
$imagedata = $imagerow['Image'];
}




$costume = $_POST['costume'];
$futuristic = $_POST['futuristic'];
$beauty = $_POST['beauty'];
$mastery = $_POST['mastery'];
$audienceimpact = $_POST['audienceimpact'];
$thisjudge = $_SESSION['Myjudge'];

$ProductionTotal = $costume + $futuristic + $beauty + $mastery + $audienceimpact;
$prodPercent = $ProductionTotal * 0.15;


$validation = "SELECT * FROM tblproduction WHERE JudgeName = '$thisjudge' AND ContestantNo = '$contestantno'";
$validquery = mysql_query($validation);
$existing = mysql_num_rows($validquery);


if ($existing == 0){

$insert = "INSERT INTO tblproduction (JudgeName, Costume, Futuristic, Beauty, Mastery, AudienceImpact, ContestantNo, ProductionTotal, ProductionPercentage) VALUES ('$thisjudge', '$costume', '$futuristic', '$beauty', '$mastery', '$audienceimpact', '$contestantno', '$ProductionTotal', '$prodPercent')";
$result = mysql_query($insert);

if($thisjudge == 'Judge 1'){
$report = "UPDATE tblreportproduction SET Judge1 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 2'){
$report = "UPDATE tblreportproduction SET Judge2 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 3'){
$report = "UPDATE tblreportproduction SET Judge3 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 4'){
$report = "UPDATE tblreportproduction SET Judge4 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 5'){
$report = "UPDATE tblreportproduction SET Judge5 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 6'){
$report = "UPDATE tblreportproduction SET Judge6 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 7'){
$report = "UPDATE tblreportproduction SET Judge7 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 8'){
$report = "UPDATE tblreportproduction SET Judge8 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 9'){
$report = "UPDATE tblreportproduction SET Judge9 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 10'){
$report = "UPDATE tblreportproduction SET Judge10 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 11'){
$report = "UPDATE tblreportproduction SET Judge11 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}


}else{

$update = "UPDATE tblproduction SET JudgeName = '$thisjudge', Costume = '$costume', Futuristic='$futuristic', Beauty= '$beauty', Mastery= '$mastery', AudienceImpact= '$audienceimpact', ContestantNo = '$contestantno', ProductionTotal='$ProductionTotal', ProductionPercentage='$prodPercent' WHERE JudgeName = '$thisjudge' AND ContestantNo = '$contestantno'";
$result = mysql_query($update);


if($thisjudge == 'Judge 1'){
$report = "UPDATE tblreportproduction SET Judge1 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

// $judge = "SELECT * FROM tblreportproduction ";
// $judgequery = mysql_query($judge);

// while ($judgerow = mysql_fetch_assoc($judgequery))
// {
// $ID = $judgerow['ID'];
// $judge1 = $judgerow['Judge1'];
// $judge2 = $judgerow['Judge2'];
// $judge3 = $judgerow['Judge3'];
// $judge4 = $judgerow['Judge4'];
// $judge5 = $judgerow['Judge5'];
// $judge6 = $judgerow['Judge6'];
// $judge7 = $judgerow['Judge7'];
// $judge8 = $judgerow['Judge8'];
// $judge9 = $judgerow['Judge9'];
// $judge10 = $judgerow['Judge10'];
// $judge11 = $judgerow['Judge11'];
// $totalprod = number_format(($judge1 + $judge2 + $judge3 + $judge4 + $judge5 + $judge6 + $judge7 + $judge8 + $judge9 + $judge10 + $judge11) / 11, 2);




// }






}elseif($thisjudge == 'Judge 2'){
$report = "UPDATE tblreportproduction SET Judge2 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 3'){
$report = "UPDATE tblreportproduction SET Judge3 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 4'){
$report = "UPDATE tblreportproduction SET Judge4 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 5'){
$report = "UPDATE tblreportproduction SET Judge5 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 6'){
$report = "UPDATE tblreportproduction SET Judge6 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 7'){
$report = "UPDATE tblreportproduction SET Judge7 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 8'){
$report = "UPDATE tblreportproduction SET Judge8 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 9'){
$report = "UPDATE tblreportproduction SET Judge9 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 10'){
$report = "UPDATE tblreportproduction SET Judge10 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}elseif($thisjudge == 'Judge 11'){
$report = "UPDATE tblreportproduction SET Judge11 = '$ProductionTotal' WHERE ID = '$contestantno'";
$report2 = mysql_query($report);

}

}




if($result)
{
if($contestantno < 10){
// $message2 = "<script language=javascript>alert('Save!')</script>";
// echo $message2;
$message = "<script language=javascript>location.href='index.php?action=dashboard&increment=$contestantno&option=$imagedata'</script>";
echo $message;
}else{
// $message2 = "<script language=javascript>alert('Save!')</script>";
// echo $message2;
$message = "<script language=javascript>location.href='index.php?action=dashboard'</script>";
echo $message;
}



// $message3 = "<script language=javascript>location.href='index.php?increment=$contestantno'</script>";
// echo $message3;
}else{
echo "Error, Call me";
}

?>

thank you.
 

Attachments

  • tabulation.png
    tabulation.png
    43.2 KB · Views: 34
Last edited:
hindi ko binasa kc mahaba pero sa tingin ko dapat ang maunang lgyan ng value ung pinaka unang id ng foreign key. tska prang mali ung associate nung dalwang table. productiontotal = totalproduction?
 
hindi ko binasa kc mahaba pero sa tingin ko dapat ang maunang lgyan ng value ung pinaka unang id ng foreign key. tska prang mali ung associate nung dalwang table. productiontotal = totalproduction?
anu po dapat sir?
 
anu po dapat sir?

d ko mabasa ung table mo lodi. ;)


yan tulungan n kita para medyo mdaling intindihin ung table tsaka mas improve ung pag gawa ng system dapat kelngan dynamic lahat
View attachment 328605

:thumbsup:

fill in mo lang ung kulang sa mga tables kung naintindihan mo ung approach ko.

example:

tbl_judges dapat ung info din meron

para sakin ito:
judge_id
judge_name
judge_seat_no
judge_info -> about me
judge password/code -> parang login

para pag ok n lhat ng contestant,category at judges nailgay mo eh maiiwasan mo ung issue ng insert pag associated sa ibang table.

pede k magpaturo ng sql statement mdaming master tau dito. bobo ako dun hehe. para pag kelngan mo ng double checking ng result sa SQL palang mlalaman mo n ung result ng contest.
 

Attachments

  • pageant.png
    pageant.png
    11.6 KB · Views: 15
Last edited:
d ko mabasa ung table mo lodi. ;)


yan tulungan n kita para medyo mdaling intindihin ung table tsaka mas improve ung pag gawa ng system dapat kelngan dynamic lahat
View attachment 1228230

:thumbsup:

fill in mo lang ung kulang sa mga tables kung naintindihan mo ung approach ko.

example:

tbl_judges dapat ung info din meron

para sakin ito:
judge_id
judge_name
judge_seat_no
judge_info -> about me
judge password/code -> parang login

para pag ok n lhat ng contestant,category at judges nailgay mo eh maiiwasan mo ung issue ng insert pag associated sa ibang table.

pede k magpaturo ng sql statement mdaming master tau dito. bobo ako dun hehe. para pag kelngan mo ng double checking ng result sa SQL palang mlalaman mo n ung result ng contest.

ok salamat po..hintay2 lng ako baka my magcomment na master dito..hehehe
 
Status
Not open for further replies.
Back
Top Bottom