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




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek