Forum Sementara Putera.com

Bersama kita perkemaskan forum ini sementara forum asal dalam pemulihan.

Forum putera dah kembali. Masalah sudah berjaya diselesaikan. Sila lawati http://forum.putera.com/tanya


    check court availability - PHP

    Share

    damia
    Ahli Baharu
    Ahli Baharu

    Number of posts : 12
    Registration date : 25/03/2009

    check court availability - PHP

    Post by damia on Mon May 04, 2009 3:43 pm

    salam..sy nk mintak tlg sgt2.sgt...next week dh nk kene present system.plz...

    masalah sy, mcamana nk check court availability (gelanggang sukan). sy ada table booking. tiap kali sblm user nk booking court, die mesti check samada court tu ksong or tak pada tarikh n masa tertentu.



    ni interface utk check availability tu.

    paling susah skali nk match kan date and time. sebab date bole sama, tapi masa tak bole sama. so bile user submit, system akan check then kalo court tu kosong pd date and time tu, kuar mesej gtau yg court available dan user bole booking.

    tolong sgt2 sape2 yg master php.sy dh nk putus asa dh.

    SHiDi
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 30
    Age : 32
    Location : Ampang
    Job/hobbies : Geek
    Registration date : 03/03/2009

    Re: check court availability - PHP

    Post by SHiDi on Tue May 05, 2009 2:25 am

    Mana table schema? Tunjukkan table schema.

    Kuzie
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 125
    Age : 32
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    Re: check court availability - PHP

    Post by Kuzie on Tue May 05, 2009 3:12 pm

    bab ni yg saya nak settle...sorry ye damia..ni die punye SQL statement lebih kurang..tapi ade ckit bugs lagi....awak boleh tolong tengokkan bugs die..sorry yek bz sangat...

    SQL ni untuk cek sama ada Court tu dah booking ke belum..Kalau xde $theCount == 0 maknanye boleh book untuk tarikh yg dipilih...

    Code:


    $sql=sprintf("SELECT COUNT(*) AS theCount FROM userbooking WHERE book_date='".$DateBook."' and start_time BETWEEN '".$Time1."' AND '".$Time2."' and end_time BETWEEN '".$Time1."' AND '".$Time2."'");
    $con= mysql_query($sql) or die(mysql_error());
    $theCount= mysql_result($con, 0, 'theCount');

    if( $theCount == 0 )
    {
    echo "Tiada Data";
             
    //      $result=mysql_fetch_array(mysql_query("SELECT * FROM userbooking WHERE book_date='$DateBook' and Negara ='$Negara'"));


    //$sql= "INSERT INTO userbooking(first_user_name, book_date, start_time , end_time, fut_court_id,Approval) VALUES('$Name', '$DateBook', '$Time1', '$Time2', '$CourtID','0')";
    //     $con= mysql_query($sql) or die(mysql_error());

    }


    Kuzie
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 125
    Age : 32
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    Re: check court availability - PHP

    Post by Kuzie on Tue May 05, 2009 3:33 pm

    Sama2 la main dengan daun keladi...nanti gatal xtau...hahahaha

    Kuzie
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 125
    Age : 32
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    Re: check court availability - PHP

    Post by Kuzie on Tue May 05, 2009 5:34 pm

    Ni Create Table SQL die:

    Code:

     CREATE  TABLE  `futsal`.`Userbooking` (  `No` double NOT  NULL  auto_increment ,
     `first_user_name` varchar( 20  )  NOT  NULL default  '',
     `last_user_name` varchar( 20  )  NOT  NULL default  '',
     `matrix_no` varchar( 20  )  NOT  NULL default  '',
     `fac_dep` varchar( 50  )  NOT  NULL default  '',
     `phone_no` varchar( 20  )  NOT  NULL default  '',
     `email` varchar( 40  )  NOT  NULL default  '',
     `name_event` varchar( 50  )  NOT  NULL default  '',
     `book_date` date NOT  NULL default  '0000-00-00',
     `start_time` time NOT  NULL default  '00:00:00',
     `end_time` time NOT  NULL default  '00:00:00',
     `fut_court_type` varchar( 20  )  NOT  NULL default  '',
     `fut_court_id` varchar( 20  )  NOT  NULL ,
     `Approval` double NOT  NULL ,
     PRIMARY  KEY (  `No`  )  ) ENGINE  =  MyISAM  DEFAULT CHARSET  = latin1;


    Sponsored content

    Re: check court availability - PHP

    Post by Sponsored content Today at 2:13 am


      Current date/time is Fri Dec 09, 2016 2:13 am