Jump to content

joemal

Members
  • Posts

    10
  • Joined

  • Last visited

joemal's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I didnt really understand what to do with what you put. I have got the manual yes, not read it yet though. Im new to coding and this is the last bit I need for the webpage. It worked perfectly as I used to "store" the total value on the database. But now I am trying to learn new ways of doing things. thats why my coding may seem back to front to you. so with your code do you mean; <?php $sql = "SELECT * FROM results WHERE cat1='1'"; $qresults = mysqli_query($link,$sql); while ($row = $qresults->fetch_array() if(mysql_num_rows($qresults) == '') { echo "<p>No Results Available."; } else { echo "<table width=\"800\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"greywritinglight\" align=\"center\"> <tr align=\"center\"> <td>Competitor</td> <td>Vehicle</td> <td>Class</td> <td>Skipton</td> <td>Weston</td> <td>King Bros</td> <td>Normans</td> <td>Norwood</td> <td>Uniroyal</td> <td>Total</td> </tr>"; $x=1; while($results_row = mysql_fetch_array($qresults)) { if($x%2): $rowbgcolor = "#FFFFFF"; else: $rowbgcolor = "#EEEEEE"; endif; echo "<tr align=\"center\" bgcolor=\"" .$rowbgcolor. "\">"; echo "<td>" . $results_row['competitor'] . "</td>"; echo "<td>" . $results_row['catvehicle'] . "</td>"; echo "<td>" . $results_row['catclass'] . "</td>"; echo "<td>" . $results_row['cat1'] . "</td>"; echo "<td>" . $results_row['cat2'] . "</td>"; echo "<td>" . $results_row['cat3'] . "</td>"; echo "<td>" . $results_row['cat4'] . "</td>"; echo "<td>" . $results_row['cat5'] . "</td>"; echo "<td>" . $results_row['cat6'] . "</td>"; echo "<td>" . $total . "</td>"; echo "</tr>"; $x++; } echo "</table>"; } ?>
  2. Also still not managed to get the coding working.
  3. @mac_gyver - I didnt login through facebook last when i signed up. I have now logged in via facebook and clicked link account with joemal?
  4. <?php $cautotest_results = mysql_query("SELECT * FROM results WHERE cat ='1' ORDER BY cattotal DESC"); $total = mysql_fetch_array("SELECT cat1 + cat2 + cat3 + cat4 + cat5 + cat6 AS total FROM results"); if(mysql_num_rows($cautotest_results) == '') { echo "<p>No Results Available."; } else { echo "<table width=\"800\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"greywritinglight\" align=\"center\"> <tr align=\"center\"> <td>Competitor</td> <td>Vehicle</td> <td>Class</td> <td>Skipton</td> <td>Weston</td> <td>King Bros</td> <td>Normans</td> <td>Norwood</td> <td>Uniroyal</td> <td>Total</td> </tr>"; $x=1; while($results_row = mysql_fetch_array($cautotest_results)) { if($x%2): $rowbgcolor = "#FFFFFF"; else: $rowbgcolor = "#EEEEEE"; endif; echo "<tr align=\"center\" bgcolor=\"" .$rowbgcolor. "\">"; echo "<td>" . $results_row['competitor'] . "</td>"; echo "<td>" . $results_row['catvehicle'] . "</td>"; echo "<td>" . $results_row['catclass'] . "</td>"; echo "<td>" . $results_row['cat1'] . "</td>"; echo "<td>" . $results_row['cat2'] . "</td>"; echo "<td>" . $results_row['cat3'] . "</td>"; echo "<td>" . $results_row['cat4'] . "</td>"; echo "<td>" . $results_row['cat5'] . "</td>"; echo "<td>" . $results_row['cat6'] . "</td>"; echo "<td>" . $total . "</td>"; echo "</tr>"; $x++; } echo "</table>"; } ?> So its like this? then on the page it gets: Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/jet2vi/public_html/download/modules/cautotest.php on line 11
  5. Hi guys, I am needing some help of how to place the coding as I can not get it to work. -- Basically I am building a website for the local motorclub and want some code that will "add up" each persons results. Here is what I have come up with but it does not work; <?php $total = mysql_fetch_array("SELECT cat1 + cat2 + cat3 + cat4 + cat5 + cat6 AS total FROM results") ?> <?php $cautotest_results = mysql_query("SELECT * FROM results WHERE cat ='1' ORDER BY cattotal DESC"); if(mysql_num_rows($cautotest_results) == '') { echo "<p>No Results Available."; } else { echo "<table width=\"800\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"greywritinglight\" align=\"center\"> <tr align=\"center\"> <td>Competitor</td> <td>Vehicle</td> <td>Class</td> <td>Skipton</td> <td>Weston</td> <td>King Bros</td> <td>Normans</td> <td>Norwood</td> <td>Uniroyal</td> <td>Total</td> </tr>"; $x=1; while($results_row = mysql_fetch_array($cautotest_results)) { if($x%2): $rowbgcolor = "#FFFFFF"; else: $rowbgcolor = "#EEEEEE"; endif; echo "<tr align=\"center\" bgcolor=\"" .$rowbgcolor. "\">"; echo "<td>" . $results_row['competitor'] . "</td>"; echo "<td>" . $results_row['catvehicle'] . "</td>"; echo "<td>" . $results_row['catclass'] . "</td>"; echo "<td>" . $results_row['cat1'] . "</td>"; echo "<td>" . $results_row['cat2'] . "</td>"; echo "<td>" . $results_row['cat3'] . "</td>"; echo "<td>" . $results_row['cat4'] . "</td>"; echo "<td>" . $results_row['cat5'] . "</td>"; echo "<td>" . $results_row['cat6'] . "</td>"; echo "<td>" . $total . "</td>"; echo "</tr>"; $x++; } echo "</table>"; } ?> Its the top line of coding... and the echo .total. at the bottom. If you could please correct me I would be ever so grateful. If you need more info please just ask. All help is appreciated. JTM.
  6. The coding of the page that displays the results to the public looks like this; <?php $cautotest_results = mysql_query("SELECT * FROM cautotest"); if(mysql_num_rows($cautotest_results) == 0) { echo "<p>No Results Available."; } else { echo "<table width=\"800\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"greywritinglight\" align=\"center\"> <tr align=\"center\"> <td>Competitor</td> <td>Vehicle</td> <td>Class</td> <td>Skipton</td> <td>Weston</td> <td>Normans</td> <td>Norwood</td> <td>Uniroyal</td> <td>Total</td> </tr>"; $x=1; while($results_row = mysql_fetch_array($cautotest_results)) { if($x%2): $rowbgcolor = "#FFFFFF"; else: $rowbgcolor = "#EEEEEE"; endif; echo "<tr align=\"center\" bgcolor=\"" .$rowbgcolor. "\">"; echo "<td>" . $results_row['competitor'] . "</td>"; echo "<td>" . $results_row['vehicle'] . "</td>"; echo "<td>" . $results_row['class'] . "</td>"; echo "<td>" . $results_row['r1'] . "</td>"; echo "<td>" . $results_row['r2'] . "</td>"; echo "<td>" . $results_row['r3'] . "</td>"; echo "<td>" . $results_row['r4'] . "</td>"; echo "<td>" . $results_row['r5'] . "</td>"; echo "<td>" . $results_row['total'] . "</td>"; echo "</tr>"; $x++; } echo "</table>"; } ?> which is; --- so if I lose the 'total' colum, what code do i replace on the table? and what gets put there?
  7. Hi, I am wanting to bring information from a number of different tables. For an example I have used two tables. The tables provide results from motorsport. I am wanting a page to display both sets of data WHERE skill is 'novice' for the novice championship. the novice championship includes events from cautotest and ctrial hence why i need both tables. I have a table called cautotest and ctrial They both contain the same structure apart from ctrial has more "rounds". This is the coding for the page i have; <?php $cnovice_results = mysql_query("SELECT * FROM cautotest, ctrial WHERE skill ='N'"); if(mysql_num_rows($novice_results) == 0) { echo "<p>No Results Available."; } else { echo "<table width=\"800\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"greywritinglight\" align=\"center\"> <tr align=\"center\"> <td>Competitor</td> <td>Vehicle</td> <td>Class</td> <td>autotest1</td> <td>autotest2</td> <td>trial1</td> <td>autotest3</td> <td>trial2</td> <td>Total</td> </tr>"; $x=1; while($results_row = mysql_fetch_array($cnovice_results)) { if($x%2): $rowbgcolor = "#FFFFFF"; else: $rowbgcolor = "#EEEEEE"; endif; echo "<tr align=\"center\" bgcolor=\"" .$rowbgcolor. "\">"; echo "<td>" . $results_row['competitor'] . "</td>"; echo "<td>" . $results_row['vehicle'] . "</td>"; echo "<td>" . $results_row['class'] . "</td>"; echo "<td>" . $results_row['autotest1'] . "</td>"; echo "<td>" . $results_row['autotest2'] . "</td>"; echo "<td>" . $results_row['trial1'] . "</td>"; echo "<td>" . $results_row['autotest3'] . "</td>"; echo "<td>" . $results_row['trial2'] . "</td>"; echo "<td>" . $results_row['total'] . "</td>"; echo "</tr>"; $x++; } echo "</table>"; } ?> Any help is appriciated
  8. This is the form i fill out to add the data to the database. The code looks like; <form action="execs/edit_cautotest.php" method="post" name="edit_cautotest" id="edit_cautotest"> <?php $id = $_GET['id']; $result = mysql_query("SELECT * FROM cautotest WHERE id = '$id'"); if(mysql_num_rows($result) == 0) { echo 'No results founds'; } else { while($row = mysql_fetch_array($result)) { $db_id = $row['id']; $db_competitor = $row['competitor']; $db_sex = $row['sex']; $db_memberno = $row['memberno']; $db_skill = $row['skill']; $db_class = $row['class']; $db_vehicle = $row['vehicle']; $db_bracket = $row['bracket']; $db_r1 = $row['r1']; $db_r2 = $row['r2']; $db_r3 = $row['r3']; $db_r4 = $row['r4']; $db_r5 = $row['r5']; $db_total = $row['total']; echo <<<END <table width="674" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="217" class="col_right">REF ID :</td> <td width="205" class="col_left"><input name="id" type="text" id="id" value="$db_id" readonly="readonly"></td> <td width="252" class="col_left"></td> </tr> <tr> <td width="217" class="col_right">Competitor :</td> <td width="205" class="col_left"><input name="competitor" type="text" id="competitor" value="$db_competitor"></td> <td width="252" class="col_left"></td> </tr> <tr> <td width="217" class="col_right">Sex :</td> <td width="205" class="col_left"><input name="sex" type="text" id="sex" value="$db_sex"></td> <td width="252" class="col_left"></td> </tr> <tr> <td width="217" class="col_right">Membership No :</td> <td width="205" class="col_left"><input name="memberno" type="text" id="memberno" value="$db_memberno"></td> <td width="252" class="col_left"></td> </tr> <tr> <td width="217" class="col_right">Skill :</td> <td width="205" class="col_left"><input name="skill" type="text" id="skill" value="$db_skill"></td> <td width="252" class="col_left"></td> </tr> <tr> <td class="col_right">Class :</td> <td class="col_left"><input name="class" type="text" id="class" value="$db_class"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Vehicle : </label></td> <td class="col_left"><input name="vehicle" type="text" id="vehicle" value="$db_vehicle"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Bracket : </label></td> <td class="col_left"><input name="bracket" type="text" id="bracket" value="$db_bracket"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Round 1 : </label></td> <td class="col_left"><input name="r1" id="r1" value="$db_r1"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Round 2 : </label></td> <td class="col_left"><input name="r2" id="r2" value="$db_r2"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Round 3 : </label></td> <td class="col_left"><input name="r3" id="r3" value="$db_r3"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Round 4 : </label></td> <td class="col_left"><input name="r4" id="r4" value="$db_r4"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Round 5 : </label></td> <td class="col_left"><input name="r5" id="r5" value="$db_r5"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"><label>Total : </label></td> <td class="col_left"><input name="total" id="total" value="$db_total"></td> <td class="col_left"></td> </tr> <tr> <td class="col_right"> </td> <td><input name="submit" type="submit" id="submit" value="Edit Competitor"></td> <td> </td> </tr> </table> END; } }?> I would like the total field to automatically calculate the values from 'round 1, 2, 3, 4, 5' Thanks - if you need more info just ask.
  9. Hi, I have a database which holds results Name | Car | etc \ etc | Round 1 | round 2 | round 3 // etc | Total the points are in the format of; e.g. 100.5 // 25.6 // 35.8 // 50.0 I input the data manually using a webpage, clicking on the relevant driver, update scores, click submit. I have to manually work out the total, is there a way I can it it automatically add the values from round 1,2,3, etc.
  10. Hi all, I am building a website for my local motorclub. we are wanting to start taking online payments for membership and events. I have built a members only area - the way to get access is for a member of staff to accept the registration. this is all fine for members who pay via cheque or simular. I am wanting a sign up process to include the payment page, was going to use paypal as the merchant. So if people want to join the club they are able to do so and get immediate access to the members only page instead of waiting for staff to check if the payment has cleared then set up there account etc. so basically i need a sign-up form (which is done) then a purchase button at the bottom, which takes the payment and then redirects to the website but 'tells my website the payment has been taken and to give full access'. I cant really explain how i want it, but i hope you understand from what i have said.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.