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


    Coding search php mysql

    Share

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Sun Mar 22, 2009 9:37 pm

    ooppss..sorry pasal SQL tu...Xcomplicated sangat pun kan..sorry yek..thanks Farlee sbb bagitau..Syira copy paste error tu pastu bagitau error kat mana yg xok...

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Tue Mar 24, 2009 11:30 am

    Code:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in c:\phpdev5\www\seminarbaru\conference_slot2.php on line 44
    Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in c:\phpdev5\www\seminarbaru\conference_slot2.php on line 70

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Tue Mar 24, 2009 1:48 pm

    try ni plak

    Code:

    <?php

    $room=$_POST[room];
    $date=$_POST[date];
    $time=$_POST[time];

    $db = mysql_connect("localhost","","");
    if (!$db)
      {
      die('Could not connect: ' . mysql_error());
      }


    //Convert Date "/" kepada "-"
    $format = '%Y-%m-%d';
    $date =strtotime($date);
    $date = strftime($format, $date );

    if ($Select1 =='Morning')
    {
    $Season1 = "09:00:00";
    $Season2= "11:00:00";
    }
    if ($Select1 =='Afternoon')
    {
    $Season1 = "11:00:01";
    $Season2 = "13:30:00";
    }
    if ($Select1 =='Evening')
    {
    $Season1 = "14:00:01";
    $Season2 = "17:30:00";
    }

    $maklumat = mysql_query("SELECT * FROM code,date,time,room,title,name from student student where room = '$room' and Date = '".$date."' and Time BETWEEN '".$Season1."' AND '".$Season2."' ");

    echo "<table class=mediumtxt width=771 align=center border=1>";
    echo "<tr><td><b>PaperCode</b></td><td><b>Date</b></td><td ><b>Time</b></td><td><b>Room</b></td><td><b>Conference Title</b></td><td><b>Presenter Name</b></td></tr>";
    while ($myrow = mysql_fetch_array($maklumat))
    {
    echo "<tr><td>";
    echo $myrow['code'];
    echo "</td><td>";
    echo $myrow['date'];
    echo "</td><td>";
    echo $myrow['time'];
    echo "</td><td>";
    echo $myrow['room'];
    echo "</td><td>";
    echo $myrow["title"];
    echo "</td><td>";
    echo $myrow['name'];
    echo "</td></tr>";
    }
    echo "</table></div></div></div></div></div></div></div></div></div>";
    mysql_close($con);
    ?>

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Tue Mar 24, 2009 4:30 pm

    Code:

    //Convert Date "/" kepada "-"
    $format = '%Y-%m-%d';
    $date =strtotime($date);
    $date = strftime($format, $date );

    if ($Select1 =='Morning')
    {
    $Season1 = "09:00:00";
    $Season2= "11:00:00";
    }
    if ($Select1 =='Afternoon')
    {
    $Season1 = "11:00:01";
    $Season2 = "13:30:00";
    }
    if ($Select1 =='Evening')
    {
    $Season1 = "14:00:01";
    $Season2 = "17:30:00";
    }

    nie code nie kne set kt dtabe ker.....

    Farlee
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 38
    Age : 33
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    Re: Coding search php mysql

    Post by Farlee on Tue Mar 24, 2009 4:30 pm

    Kuzie wrote:....
    $db = mysql_connect("localhost","","");
    ....
    takder nama user utk MySQL ke, kuzie?
    Lagipun kalu syira berdepan dgn masalah ini, kemungkinan nama user atau password database syira lain dgn kuzie.

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Tue Mar 24, 2009 5:09 pm

    Code:

    //Convert Date "/" kepada "-"
    $format = '%Y-%m-%d';
    $date =strtotime($date);
    $date = strftime($format, $date );

    if ($Select1 =='Morning')
    {
    $Season1 = "09:00:00";
    $Season2= "11:00:00";
    }
    if ($Select1 =='Afternoon')
    {
    $Season1 = "11:00:01";
    $Season2 = "13:30:00";
    }
    if ($Select1 =='Evening')
    {
    $Season1 = "14:00:01";
    $Season2 = "17:30:00";
    }

    nie code nie kne set kt dtabe ker.....

    Farlee
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 38
    Age : 33
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    Re: Coding search php mysql

    Post by Farlee on Tue Mar 24, 2009 5:18 pm

    Takder kaitan dengan database, hanya nak umpukkan nilai dalam variable parameter je...
    dan penyata if..else tu memuat perbandingan sama ada ianya padan dengan nilai dalam parameter atau tidak.

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Tue Mar 24, 2009 5:41 pm

    Farlee wrote:
    Kuzie wrote:....
    $db = mysql_connect("localhost","","");
    ....
    takder nama user utk MySQL ke, kuzie?
    Lagipun kalu syira berdepan dgn masalah ini, kemungkinan nama user atau password database syira lain dgn kuzie.

    Xtahu la plak Farlee..Yg atas tu aku xtukar rasenye...

    Farlee
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 38
    Age : 33
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    Re: Coding search php mysql

    Post by Farlee on Wed Mar 25, 2009 10:23 am

    syira86 wrote:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in c:\phpdev5\www\seminarbaru\conference_slot2.php on line 44
    Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in c:\phpdev5\www\seminarbaru\conference_slot2.php on line 70
    Daripada error yg syira bg nih, sy rasa database x di'connect', mcm masa connect tu, ada something wrong. Kalu nk tau error ke x, enable kan MySQL server, bukak command prompt, isi direktori sampai ke folder adanya mysql.exe kemudian taip -> "mysql -u root" (default). Kalu bleh masuk cara 'default', kena ubah koding kat sini ->
    Code:
    mysql_connect(localhost,"root","");
    Kalaulah bleh masuk, tapi dapat error jugak, maknanya salah pemilihan database juga adalah problem nye
    Code:
    mysql_select_db("seminar");
    Betul database syira ni ialah "seminar"? Cek ejaan database dan ejaan dalam koding tu btul2.

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Wed Mar 25, 2009 2:37 pm

    salam..sy tnye tutor ..die utk coding sy kne letak AND sttment jer..tp tdi die cube wat jg tp stil xdpt la...
    coding awk bg 2 stil ade error ditmpt yg sma wlaupn dah check "seminar" n ltk "localhost","root","".......btl2 rase tertekan nie..tgal 2mgu jer ade nk present..hhuuuhuh

    adakah sebab sy gune php dev5...cz ade error???

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 2:54 pm

    Senang citer camni laa...awak zipkan folder System sekali dgn database hantar kat saya..hehehe



    Sekian terima kasih...


    Last edited by Kuzie on Thu Mar 26, 2009 9:52 am; edited 2 times in total

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Wed Mar 25, 2009 3:21 pm

    salam..sy dah antar folder sy dlm bntuk zip..awk check la..dpt ke x..thnx ye awk

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 3:24 pm

    Folder sudah sampai dgn selamatnye....nanti hamba perhatikan.....doa2 kan agar hamba dapat menyelesaikan dalam masa yg terdekat....

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 3:27 pm

    Satu lagi syira...mana satu form 1st nak masuk ni...???SQL database letak kat mana???

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 4:22 pm

    Syira...Sebenarnye file database mysql tu ada dalam awak punye folder yg awak install MySQL...Basic file dalam tu seperti dibawah :

    Nama Folder = nama database yg awak create...
    Contoh path : C:\....\mysql\mysql5.0.51b\data\login

    Dalam folder data tu mempunyai semua maklumat database yg awak pernah create.
    login tu databas yg di create:

    Dalam folder tu basic mmg ade 3(tambah 1 table yg awak create) contoh file tu seperti dibawah:
    active_users.frm
    db.opt
    user.frm

    Sekiranye awak create satu lagi table bertambah la satu lagi file dalam folder tu.

    Yg paling senang nak tengok kalau awak install WAMP( Window Apache MySql Php). Software ni mmg dah ada Apache, MySQL dan PHP didalam.Just install sahaja dan database MySQL boleh dilihat secara terus meaning ada interface bukan coding dalam MS-DOS.

    Awak boleh download file die kat sini WAMP.

    Saya harap awak boleh send file database tu sekali dgn system dan zipkan...

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 4:33 pm

    Interface boleh tengok kat sini...


    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 11:56 pm

    Hi Syira...semua dah siap...xpayah tukar pape dalam database..Ignore jek pasal tukar2 dalam database sebelum ni..guna database asal awak..ok....hope xpayah muram2 dah..smile alwayyzzz cheers

    Ni coding untuk MAIN.php

    Code:

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Main</title>
    </head>
    <body bgcolor="#CC9900">
    <div align="center">
       <table border="0" cellpadding="0" cellspacing="0" width="932" height="771">
          <!-- MSTableType="layout" -->
          <tr>
             <td valign="top" colspan="2" height="302">
             <!-- MSCellType="ContentHead" -->
             <div style="position: absolute; width: 672px; height: 128px; z-index: 2; left: 46px; top: 144px" id="layer2">
                <b><font face="Goudy Old Style" size="7">
                <marquee scrollamount="7" behavior="alternate" scrolldelay="93">INFORMATION&nbsp; TECHNOLOGY&nbsp; CONFERENCE INFORMATION&nbsp; TECHNOLOGY&nbsp; CONFERENCINFORMATION&nbsp; TECHNOLOGY&nbsp; CONFERENC</marquee></font></b></div>
             <img border="0" src="Picture2.png" width="932" height="302"></td>
          </tr>
          <tr>
             <td valign="top" height="419" bgcolor="#FBFBE4" align="center">
          
          <?php
    echo"<form method='POST' action='conference_slot2.php'>";
    echo
    "<select  name='date'>
    <option></option>
    <option value=23/03/2009>23/03/2009</option>
    <option value=24/03/2009>24/03/2009</option>
    <option value=25/03/2009>25/03/2009</option>      
    </select>

    <select name=time>
    <option></option>
    <option>9-11am</option>
    <option>11-1.3</option>
    <option>2-5.30</option>
    </select>

    <select  name=room>
    <option value=dkg4/1>dkg4/1</option>
    <option value=dkg4/2>dkg4/2</option>
    <option value=dkg4/3>dkg4/3</option>
    </select>

    <input type='submit' value='Search' name='B1'></form>";

       ?>
             </td>
             
             <td valign="top" rowspan="2" width="163" bgcolor="#FDFCE8">
             <!-- MSCellType="NavBody" -->
             <div style="position: absolute; width: 165px; height: 172px; z-index: 1; left: 787px; top: 614px" id="layer1">
                <img border="0" src="images.jpg" width="180" height="169"></div>
             <div style="position: absolute; width: 294px; height: 92px; z-index: 4; left: 62px; top: 554px" id="layer4">
                <p align="left"><b>Hubungi Kami di:<br>
                Urusetia SKPP09<br>
                Kolej Sastera Dan Sains<br>
                Universiti Utara Malaysia<br>
                06010 Sintok<br>
                Kedah</b><br>
                <br>
                Tel : 04-9283301 / 3313<br>
                Faks : 04-9285766 / 3378<br>
    &nbsp;</div>
    &nbsp;</td>
          </tr>
          <tr>
             <td valign="top" height="50" width="769" bgcolor="#A17416">
             <!-- MSCellType="ContentFoot" -->
             &nbsp;</td>
          </tr>
       </table>
    </div>

    </body>

    </html>


    Last edited by Kuzie on Thu Mar 26, 2009 12:16 am; edited 2 times in total

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Wed Mar 25, 2009 11:57 pm

    Ni untuk coding conference_slot2.php

    Code:


    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Conference</title>

    </head>

    <body bgcolor="#1B295B">
    <div align="center">
    <?php
    $room=$_POST['room'];
    $date=$_POST['date'];
    $time=$_POST['time'];

    //Convert Calendar "/" kepada "-"
    //$format = '%Y-%m-%d';
    //$date =strtotime($date);
    //$date = strftime($format, $date );
    ?>
    <table border="0" cellpadding="0" cellspacing="0" width="825" height="796" bgcolor="#808000">
       <!-- MSTableType="layout" -->
       <tr>
          <td valign="top" msopnltype="NavBody" height="796" width="825" align="center" bgcolor="#BCEDF7">
          <!-- MSCellType="ContentBody" -->
          <img border="0" src="Uum.jpg" width="825" height="191"><p align="center">&nbsp;</p>
          <b><font size="6">Conference slot&nbsp; <?php echo $date; ?>
          </font></b>
          <p><b><font size="6">
          <?php
       
    // ** MySQL settings ** //
    define('DB_NAME', 'db_myProject');    // The name of the database
    define('DB_USER', 'root');    // Your MySQL username
    define('DB_PASSWORD', ''); // ...and password. Leave it blank if you are using EasyPHP!!
    define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value

    $db = mysql_connect("localhost","root","");
    if (!$db)
      {
      die('Could not connect: ' . mysql_error());
      }

    mysql_select_db("seminar", $db);   

    echo
    "<table class=mediumtxt width=771 align=center border=1>";
    echo "<tr><td><b>PaperCode</b></td><td><b>Date</b></td>
    <td ><b>Time</b></td>
    <td><b>Room</b></td>
    <td><b>Conference Title</b></td>
    <td><b>Presenter Name</b></td></tr>";
    $result = mysql_query("SELECT * FROM student where date='$date'  AND time='$time' AND room='$room'");
    while($myrow=mysql_fetch_array($result))
    {
    echo "<tr><td>";
    echo $myrow["code"];
    echo "</td><td>";
    echo $myrow["date"];
    echo "</td><td>";
    echo $myrow["time"];
    echo "</td><td>";
    echo $myrow["room"];
    echo "</td><td>";
    echo $myrow["title"];
    echo "</td><td>";
    echo $myrow["name"];
    echo "</td></tr>";
    }
    echo "</table></div>
          </div>
          </div>
          </div>
          </div>
          </div>
          </div>
          </div>
          </div>
          ";
    ?></font></b></td>
       </tr>
    </table>
    </div>
    * This conference slot will be change
    </body>
    </html>

    Farlee
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 38
    Age : 33
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    Re: Coding search php mysql

    Post by Farlee on Thu Mar 26, 2009 11:38 am

    Jadi mmg betul lah... key-in MySQL is a primary problem kenapa syira tu dapat error mysql_fect_assoc() adalah kosong isinya.

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Thu Mar 26, 2009 12:51 pm

    yup...primary problem boleh dikatakan yg tu..tapi minor problem pun banyak gak....tapi minor je...

    cikdayah
    Ahli Baharu
    Ahli Baharu

    Number of posts : 56
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by cikdayah on Thu Mar 26, 2009 1:27 pm

    terernya kuzie ni siap boleh tolong tengok kan database lagi..boleh la blajar php dengan kamu nanti..saya budak baru belajar..Wink

    Kuzie
    Ahli Baharu
    Ahli Baharu

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

    Re: Coding search php mysql

    Post by Kuzie on Thu Mar 26, 2009 2:55 pm

    saya pun tgh belajar ni..sama2 la belajar... Smile

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Fri Mar 27, 2009 1:00 pm

    salam..kuzie thnx byk2 ye..tp sy blum test lg coding cz ade midterm exam..ape2 nti inform awk blik if ade error...niway thnx byk2 Very Happy Very Happy

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Fri Mar 27, 2009 2:29 pm

    n maaf la cz xreply mse awk tnye solan..sorry noh..ade periksa la Laughing

    syira86
    Ahli Baharu
    Ahli Baharu

    Gender : Female Number of posts : 108
    Age : 30
    Location : kedah
    Job/hobbies : explore
    Registration date : 04/03/2009

    Re: Coding search php mysql

    Post by syira86 on Sat Mar 28, 2009 11:30 am

    tnx byk2 kuzie..coding awk bg xde error lgsung...jln dng ok.....skrg sy ade fkr nk bg lg web sy nie....ape pndapt if sy wat calerdar dlm web nie...nie sy bg image web kt internet..cmne nk wat????

    [img][/img]

    Sponsored content

    Re: Coding search php mysql

    Post by Sponsored content Today at 9:03 am


      Current date/time is Sat Dec 10, 2016 9:03 am