Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 24-04-2007, 11:43 AM
Novice Webmaster
 
Join Date: Apr 2007
Location: kuantan
Posts: 21
Rep Power: 0
beih107 is on a distinguished road
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\">";
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-05-2007, 05:19 AM
genzy's Avatar
Nowhere Webmaster
 
Join Date: Aug 2006
Location: Malaysia
Posts: 1,581
Rep Power: 59
genzy is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 18-05-2007, 10:08 AM
New kid on the block
 
Join Date: May 2007
Location: Selayang
Posts: 5
Rep Power: 0
polturgiest is on a distinguished road
Send a message via MSN to polturgiest Send a message via Yahoo to polturgiest
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Ads to Display? azoundria Revenue and Monetization 7 11-06-2007 08:10 PM
display php code in wordpress mdpai Blogging Discussion 3 22-02-2007 12:55 AM
display data,camne??? adib Website Programming 14 21-08-2004 10:27 AM
display value listbox nov8998 Website Programming 1 25-06-2004 02:21 PM
Display contents mysticmind Website Design 3 04-05-2003 08:55 PM



All times are GMT +8. The time now is 07:08 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60