Results 1 to 3 of 3

Thread: help me..data tak boleh display

  1. #1
    Join Date
    Apr 2007
    Location
    kuantan
    Posts
    21
    Rep Power
    0

    help me..data tak boleh display

    hi sume..saya ada mslh mengenai data x boleh display kat interface sistem..tp dalam database data tersebut dah masuk..n then data tersebut hanya boleh display kat page lain bukan page yg spatutnye..query untuk page ni adalah gabungan 3 table..so,apa yg saya perlu buat atau ubah?

    coding interface

    <? include("odbc.php");
    include("banner.php");
    include("homestaff.php");
    ?>

    <html>

    <head>

    <script language="JavaScript" src="calendar.js"></script>
    <title>borrow file record</title>

    </head>

    <body>

    <br>
    <table width="100%" cellpadding="2" cellspacing="0" border="0" bordercolor="#000000" align="center">


    <tr>
    <td align="right">
    <a href="staff.php"><strong>Sign Up</strong></a>
    </td>
    </tr>


    <tr align="center">
    <td height="400" valign="top">

    <form method="POST" name="form" action="borrowprocess.php">
    <br><table align="center" bgcolor="#FF9966">
    <tr>
    <td width="104" height="36"><strong>Borrow Date :</strong></td>
    <td width="183"><input type="text" name="borrowdate">
    <a href="javascript:show_calendar('form.borrowdate'); " onMouseOver="window.status='borrowdate';return true;" onMouseOut="window.status='';return true;"><img src="images/b_calendar.png" width=16 height=16 border=0 align="middle"></a></td>
    </tr>


    <tr>
    <td height="29"><strong>Staff No :</strong></td>
    <td><select name="staffno">
    <option value="">Please Select Staff No</option>
    <?
    $sqlst = mysql_query("SELECT * FROM staff");
    while($staf = mysql_fetch_array($sqlst))
    { ?>
    <option value="<? echo $staf['staff_id'] ?>"<?php if($code['staff_id'] == $code1) echo ' selected="selected"'; ?>><? echo $staf['staffno'];?> </option>
    <? } ?>
    </select>
    <a href="staffrecord.php?staff_id=<? echo $result['staff_id'];?><? echo $result['staff_name'];?>');">[details]
    </a>


    </tr>

    <tr>
    <td><strong>File Name:</strong></td>
    <td><select name="file">
    <option value="">Select File</option>
    <?
    $sqlst = mysql_query("SELECT * FROM item");
    while($code = mysql_fetch_array($sqlst))
    { ?>
    <option value="<? echo $code['item_id'] ?>"<?php if($code['item_id'] == $code1) echo ' selected="selected"'; ?>><? echo $code['item_name'];?> </option>
    <? } ?>
    </select></td>
    </tr>

    <tr>
    <td><strong>Return Date :</strong></td>
    <td><input type="text" name="returndate">
    <a href="javascript:show_calendar('form.returndate'); " onMouseOver="window.status='returndate';return true;" onMouseOut="window.status='';return true;"><img src="images/b_calendar.png" width=16 height=16 border=0 align="middle"></a></td>

    </tr>

    <tr>
    <td colspan="2" align="center"><input type="submit" name="hantar" value="ADD">
    <input type="reset" name="padam" value="CANCEL"></td></tr>
    </table>
    </form>

    <table align="center" border="1" bordercolor="#000000" width="100%">

    <tr bgcolor="#FF5C0F">
    <td colspan="7" align="center"><strong>BORROW FILE RECORD</strong></td>
    </tr>

    <tr>
    <td width="7%" align="center"><strong>No</strong></td>
    <td width="13%" align="center"><strong>Borrow Date </strong></td>
    <td width="13%" align="center"><strong>Staff No</strong></td>
    <td width="18%" align="center"><strong>File Name </strong></td>
    <td width="12%" align="center"><strong>Return Date </strong></td>
    <td width="20%" align="center"><strong>Action</strong></td>
    </tr>

    <?

    $i=1;
    $sqlstmt =mysql_query("SELECT item.*, borrow.*, staff.*
    FROM staff RIGHT JOIN (item RIGHT JOIN borrow ON item.item_id=borrow.item_id)
    ON staff.staff_id=borrow.item_id");

    while($result = mysql_fetch_array($sqlstmt))

    ?>

    <tr>
    <td height="31"><? echo $i;?>&nbsp;</td>
    <td><? echo date('d-m-Y',strtotime($result['borrowdate']));?>&nbsp;</td>
    <td><? echo $result['staffno'];?>&nbsp;</td>
    <td><? echo $result['item_name'];?>&nbsp;</td>
    <td><? echo date('d-m-Y',strtotime($result['returndate']));?>&nbsp;</td>

    <td align="center"><p><a href="deleteborrow.php?borrow_id=<? echo $result['borrow_id'];?>" onClick="return confirm('Are You Sure To Delete? \n <? echo $result['staffno'];?>');"><img src="images/butdel.jpg" border="0"></a>&nbsp;
    <a href="editborrow.php?borrow_id=<? echo $result['borrow_id'];?>" onClick="return confirm('Are You Sure To Edit? \n <? echo $result['staffno'];?>');"><img src="images/butedit.jpg" border="0"></a>
    </p>
    </td>


    </tr>



    </table>

    </td>
    </tr>

    <tr>
    <td>&nbsp;</td>
    </tr>



    </table>

    </body>
    </html>

    process

    <?php
    include("odbc.php");
    echo $borrow=$_POST['borrowdate'];
    echo $borrow = substr($borrow,6,4)."_".substr($borrow,3,2)."_".su bstr($borrow,0,2);
    echo $staff = $_POST['staffno'];
    echo $file= $_POST['file'];
    echo $return = $_POST['returndate'];
    echo $return = substr($return,6,4)."_".substr($return,3,2)."_".su bstr($return,0,2);


    $query_add_data = "INSERT INTO borrow(borrowdate,staff_id,item_id,returndate) VALUES ('$borrow','$staff','$file','$return')";
    $result = mysql_query($query_add_data);

    echo "<META HTTP-EQUIV=Refresh CONTENT=\"3; URL=borrowrecord.php\">";
    ?>

  2. #2
    Join Date
    Aug 2006
    Location
    Malaysia
    Posts
    1,576
    Rep Power
    185
    Which table data do you mean??
    'Dah masuk' - When? Is the data just inserted on that page? or already exist?

    Check whether the query results in the page per what you want and query criteria, in the MySQL console or GUI front-end tool to analyse the query first.

    Tip: It is a good practice to put comments for a certain block of coding statements/SQL queries. Coding documentation is very important. If not, future maintenance will be a very painful nightmare.

  3. #3
    Join Date
    May 2007
    Location
    Selayang
    Posts
    5
    Rep Power
    0
    hie

    instead of using
    PHP Code:
    $sqlst mysql_query("SELECT * FROM staff"); 
    try debugging it using
    PHP Code:
    $sqlst mysql_query("SELECT * FROM staff") or die(mysql_error()); 
    from there can get the mysql error msg..hope this help

    note: dont forget to remove it later

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. data cleansing, data management and web design
    By fiafeehily in forum Other Internet Marketing Methods
    Replies: 0
    Last Post: 06-12-2009, 07:48 PM
  2. Led Display
    By daniels_co in forum Advertise Your Services
    Replies: 0
    Last Post: 10-07-2009, 04:13 PM
  3. How do i display data from mysql database?
    By silentD in forum Website Programming
    Replies: 2
    Last Post: 14-01-2008, 10:16 AM
  4. Best Ads to Display?
    By azoundria in forum Revenue and Monetization
    Replies: 7
    Last Post: 11-06-2007, 08:10 PM
  5. display data,camne???
    By adib in forum Website Programming
    Replies: 14
    Last Post: 21-08-2004, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37