Jump to content

daveh24706

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

daveh24706's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello, Im trying to create a league table where a user selects a year ie (2009-2010) and the league table is printed out for than year. However the problem im having is i can get it to print out table but only one team at a time and i cant get it to print out the full table. If anyone can tell me how i can retrieve all teams and display on a databases it would be great. <?php $q=$_GET["q"]; $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("lfc", $con); $sql="SELECT * FROM rankings WHERE id = '".$q."'"; $result = mysql_query($sql); echo "<table border='8'> </tr> <th>Position</th> <th>Team Name</th> <th>Played</th> <th>Won</th> <th>Drew</th> <th>Lost</th> <th>For</th> <th>Against</th> <th>GoalD</th> <th>Pts</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['Name']. "</td>"; echo "<td>" . $row['P'] . "</td>"; echo "<td>" . $row['W'] . "</td>"; echo "<td>" . $row['D'] . "</td>"; echo "<td>" . $row['L'] . "</td>"; echo "<td>" . $row['F'] . "</td>"; echo "<td>" . $row['A'] . "</td>"; echo "<td>" . $row['GC'] . "</td>"; echo "<td>" . $row['Pts'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> html page <select name="users" onchange="showUser(this.value)"> <option value="">Select Season Year:</option> <option value="1">2009/2010 Season</option> the structure on my database is id (which increments) then teamname, pts, wins etc anyone know how to print all teams/ids
  2. ok, so i replace $submit = $_POST['submit']; with if(isset($_POST['submit'])) i dont think i fully understand, i did this put still the same problem
  3. well the button is called register <input type='submit' name='submit' value='Register'>
  4. hello, im new to php,only at it a week and im writing a registration script. I cant figure out what im doing wrong. When i enter my details and click register nothing happens and its just goes back to original register form. i dont even get an error message. my code is below. <?php // set a submit variable $submit = $_POST['submit']; // other values that need to be obtained from the form $fullname = $_POST['fullname']; $username = $_POST['username']; $password = $_POST['password']; $repeatpassword = $_POST['repeatpassword']; $date = date("y-m-d"); $email = $_POST['email']; if ($submit) { //Open database $connect = mysql_connect("localhost","root",""); mysql_select_db("phplogin");//select database $namecheck = mysql_query("SELECT username FROM users WHERE username='$username'"); $count = mysql_num_rows($namecheck); if($count!=0) { die("Username already taken!"); if ($fullname&&$username&&$password&&$repeatpassword&&$email) { if ($password==$repeatpassword) { if (strlen($username)>25 || strlen ($fullname)>25) { echo "username/fullname is too long. Max 25 characters"; } else { if (strlen($password) >25 || strlen ($password) <6) { echo "password must be between 6 and 25 characters"; } else { //register the user $queryreg = mysql_query("INSERT INTO users VALUES ('','$fullname','$username','$password','$email')"); die ("you have been registered! <a href='index.php'>return to login page </a>"); } } } else echo "your passwords do not match"; } else echo "please fill in all fields"; } } ?>
×
×
  • 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.