Results 1 to 3 of 3

Thread: help tak boleh display

  1. #1
    Join Date
    Apr 2007
    Rep Power

    help tak boleh display

    hi sume..saya ada mslh mengenai data x boleh display kat interface 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,apa yg saya perlu buat atau ubah?

    coding interface

    <? include("odbc.php");



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



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

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

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

    <form method="POST" name="form" action="borrowprocess.php">
    <br><table align="center" bgcolor="#FF9966">
    <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>

    <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>
    <? } ?>
    <a href="staffrecord.php?staff_id=<? echo $result['staff_id'];?><? echo $result['staff_name'];?>');">[details]


    <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>
    <? } ?>

    <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>


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

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

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

    <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>


    $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))


    <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>








    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
    Rep Power
    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
    Rep Power

    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 38 39