PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 3rd, 2004, 06:20 AM
franches franches is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 16 franches User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question manipulating data display

hi,
i would like to ask your help about my code. i'm doing a borrowing form. what i really want to do is display the available data. i have a table workstation wherein it contains all the computer stations. i have a table borrow which contains the field ToolID, BrDate,BrFrom,Station,PIC,RtDate,RtTo,Authorized_B y.

In my combo box i only want to display the available station. The data displayed from the workstation table will depend on the borrow table. The station will only be displayed if in the borrow table ToolID and RtDate are not null.

i really don't know what to do. i'm still on the process of learning php.

thanks in advance.

PHP:
<?php
$db
=mysql_connect("localhost","root");
mysql_select_db("mydatabase",$db);
$query = "SELECT * FROM workstation ORDER BY station ASC";
$result = mysql_query($query) or die(mysql_error());

echo
"<select name=\"Station\" size=\"1\">";
while(
$row = mysql_fetch_array($result))
{
$query1 = "select * from borrow where ToolID='$ToolID' and RtDate='$RtDate' and Station='$row'";
$result1 = mysql_query($query1) or die(mysql_error());
$row1=mysql_fetch_row($result1);
if (
$row1[0]==0) {
echo
"<option>".$row['station'];
}
}
echo
"</select>";
?>

Reply With Quote
  #2  
Old September 4th, 2004, 02:33 AM
franches franches is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 16 franches User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

Maybe I think I didn't write it clearly that's why nobody answered my problem.

ToolID exist because it contains the hardwarelock that the user will borrow. The Station exist because that is computer station they're going to use for the hardwarelock. hope im making sense.
2 tables(workstation,borrow). The workstation table contains all the list of computer stations and this is where the combo box list get the data, however, it also check if the certain comp. stations are being used in the borrow table. In the borrow table the station can be considered available if the ToolID and RtDate are filled.

Quote:
ex.
"borrow table"
ToolID ---------- RtDate ---------- Station
arcv05 ---------- 9/3/04 ---------- Solaris
*null* ---------- *null* ---------- Stargazer

"workstation table"
station
Solaris
Stargazer
Gemini
I have a borrowing form which asks for Pin#: and Workstation: which is a combo box list. Now if I'm going to fill up the form I will not be able to see the "Stargazer" station since from the borrow table it is null or it means someone is still using it. what I will only see from the combo box is the Solaris and Gemini stations. If the ToolID and RtDate are filled it means it's not already in use.
I hope I explained it well.

I'm doing this so that the user will only see the available stations which they can use.

Please check again my code i've made some changes but still the combo box doesn't show any list.


PHP Code:
<?php
$db
=mysql_connect("localhost","root");
mysql_select_db("mydatabase",$db);
$tablename "workstation";
$query "SELECT * FROM $tablename ORDER BY station ASC";
$result mysql_query($query) or die(mysql_error());
 
echo 
"<select name=\"Station\" size=\"1\">";
while(
$row mysql_fetch_array($result))
{
$query1 "select PIC borrow where ToolID<>'' and RtDate<>'' and Station=$row[0]"
$result1 mysql_query($query1) or die(mysql_error());
$row1=mysql_fetch_row($result1);
    if (
$row1[0]==NULL) {
    echo 
"<option>"$row[0];

}
echo 
"</select>";
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > manipulating data display


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway