Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <b>Klassement spelers</b>
- <?php
- //dropdownlist hier, naam selecten en alle results
- require_once 'functions.php';
- $result = q_select("*", "speler", "naam=".$naam);
- $res = dbarray($result);
- echo $res;
- if(dbrows($result) > 0) {
- echo "<table>
- <tr>
- <th>Speler</th>
- <th>Score</th>
- </tr>";
- foreach($res in $result) {
- echo "<tr>
- <td>".$res['naam']."</td>
- <td>".$res['score']."</td>
- </tr>";
- }
- echo "</table>";
- }
- ?>
- <?php
- $host = "localhost";
- $user = "admin";
- $pass = "";
- $connection = mysql_connect($host,$user,$pass) or die('Could not connect: ' . mysql_error());
- mysql_select_db('spelers');
- function q_insert($fields, $values, $table) {
- if($fields != "")
- $fields = "(".implode($fields, ", ").")";
- $values = implode($values, ", ");
- $res = "INSERT INTO $table $fields VALUES ($values)";
- return dbquery($res);
- }
- function q_select($fields, $table, $where) {
- if($fields != "*") $fields = implode($fields, ", ");
- $res = "SELECT $fields FROM $table WHERE $where";
- $res = dbquery($res);
- return $res;
- }
- function dbarray($query) {
- $res = mysql_fetch_assoc($query);
- return $res;
- }
- function dbrows($query) {
- $res = mysql_num_rows($query);
- return $res;
- }
- ?>
Add Comment
Please, Sign In to add comment