Jump to content

metrostars

Members
  • Posts

    169
  • Joined

  • Last visited

    Never

Posts posted by metrostars

  1. <?php
    else if($user !== $_SESSION['user_id']){
    	$query = mysql_query("SELECT id, username, email, level FROM userbase") or die(mysql_error());
    	while ($row = mysql_fetch_array($query)){
    		if($_GET['user'] == $row['id']){
    			gHeader('Userlist: '.$row['username']);
    			echo '<table border="1px">';
    			echo '<tr><td>username</td><td>' . $row['username'] . '</td><tr>';
    			echo '<tr><td>User ID</td><td>' . $row['id'] . '</td><tr>';
    			echo '<tr><td>Email</td><td>' . $row['email'] . '</td><tr>';
    			echo '<tr><td>User Level</td><td>' . $row['level']; levelTitles($row['level']) . '</td><tr>';
    			echo '</table>';
    		}
    	}
    }
    ?>
    

     

    <?php
    function levelTitles($titleno){
    if($titleno == '4') {echo ' (Administrator)';}
    else if($titleno == '3') {echo ' (Moderator)';}
    else if($titleno == '2') {echo ' (Regular User)';}
    else if($titleno == '1') {echo ' (New User)';}
    else if($titleno == -'1') {echo ' (Banned)';}
    
    ?>
    

     

    I'm don't have access to a server so I can't test it ATM.

     

    EDIT: Didn't notice the single = instead of comparator.

  2. Hi.

     

    I 2 tables like this.

     

    users

     

    id                    1                  2

    firstname          Bob              Jimmy

    lastname        Hendrix          Marley

    ...

     

    and

     

    bookings

     

    id                    1                      2

    userid              2                      2

    date          2008-08-12        2008-08-15

    ...

     

    What I would like is to select a number of fields from users and also the id from bookings that links bookings.userid to users.id.

     

    So:

     

    1                      users.id

    Jimmy                firstname

    Marley              lastname

    2                    bookings.id

     

    There must only be 1 id returned for bookings.id per user.

     

    I've tried a number of strawberry mthods but i can't the right one.

     

    Thanks

  3. This is my query currently:

     

    "SELECT distinct(departicao), depart FROM flights WHERE NOT EXISTS(SELECT `bookings`.`id` FROM bookings WHERE `date`='$date' AND `bookings`.`flightid`=`flights`.`id`) AND `$day`='1' GROUP BY departicao"

     

    And say i have these 2 tables.

     

    [pre]

    bookings:

              id      flightid  date

              0        2        2007-12-30

     

    flights:

    id        depart            departicao  Mon      Tue    Wed      Thu      Fri      Sat      Sun        deptime

    2        Newcastle          EGNT      0          0      0        0        0        0        1        00:14:56

    4        Los Angeles        KLAX      0          0      0        0        0        0        0        15:00:00

    6        Los Angeles        KLAX      0          0      0        0        0        0        1        11:30:00 

    [/pre]

     

    However, only Newcastle shows in this case, only Los Angeles should show.

    But id i empty the bookings table, both Newcastle and Los Angeles show, as they should.

  4.     <select name="birthmonth">
        <?php 
        $a = 1;
        
        while ($a <= 12)
        {
          $b = date("F", mktime(0, 0, 0, $a, 1, 0));
        
          if ($regbirthmonth == $b)
          {
            $selected = 'selected';
          }
          else
          {
            $selected = '';
          }
        
          echo "<option value=\"$b\" $selected>$b</option>";
          $a++;
        }
        ?>
        </select>

     

    Try that.

     

    Edit: I also recommedn changing $selected = 'selected'; to $selected = 'selected=\"selected\"'; so that it is correct HTML encoding.

  5. <? ob_start(); ?>
    <?
    require_once('config.php');
    $user = $_GET['u'];
    $pass = $_GET['p'];
    $serial = $_GET['s'];
    
    $q = mysql_query("SELECT * FROM `usr_db` WHERE `users` = '".$user."' AND `password` = '".$pass."' AND `serial` = '".$serial."'");
    $number = mysql_num_rows($q);
    if($number == 0) {echo "0";} else {echo "1";}
    ?>

  6. Doubt it can be done with PHP alone, What you will have to do is to use a HTML header

     

    <meta http-equiv="refresh" content="300" />

     

    Then use PHP, the number will have to be stored in a session or txt file. You can use PHP to open the txt, find the current number, add 1 to it, and then write the new number to the file. or use a database.

×
×
  • 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.