473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Help plz...if statement

9
i am trying to view result based on this condition;

User selects start and end date...so

select * from table between start date and end date.

now 2nd check after the above query should be;

if the (quantity = 0) in any of these start and end date...then display message...else if the quantity does not = 0 in any of the row (start & end date) then display the results.

the problem at the moment is the if statement is under the while statement..that is causing to print out both..the msg and the results.....

[php]
while($row11 = mysql_fetch_array($result)){


$av = $row11['av'];

if ($av==0){

echo"sorry no rooms available";}

else {

echo "<form>";......etc }

}
[/php]

how do sort this problem out?
Apr 23 '07 #1
4 1062
exoskeleton
104 100+
i am trying to view result based on this condition;

User selects start and end date...so

select * from table between start date and end date.

now 2nd check after the above query should be;

if the (quantity = 0) in any of these start and end date...then display message...else if the quantity does not = 0 in any of the row (start & end date) then display the results.

the problem at the moment is the if statement is under the while statement..that is causing to print out both..the msg and the results.....

[php]
while($row11 = mysql_fetch_array($result)){


$av = $row11['av'];

if ($av==0){

echo"sorry no rooms available";}

else {

echo "<form>";......etc }

}
[/php]

how do sort this problem out?
what results are you trying to view sir, i mean in what format? in your if statement...is will show the result repeatedly of course..now...what kind of result you really want? :)
Apr 24 '07 #2
mmc
9
hi

---------------- Qty type
Day1--------- 0 test1
Day1----------- 3 test2

Day2 2 test1
Day2 1 test2

Day3 1 test1
Day3 1 test2

if Qty is zero...it should not display any of the test1.....for any days...it should only display test2...

Day1 3 test2
Day2 2 test2
Day3 1 test2

and from here ....then i wanted to display the lowest qty row...so FINAL output

Day3 1 test2.........
Apr 24 '07 #3
exoskeleton
104 100+
hi sir...what are the inputs when searching? should i enter DAY1 or TEST2? if test2 then the result must be:

COL1 || QTY || ITEM

DAY1 || 2 || TEST2
DAY2 || 1 || TEST2
DAY3 || 4 || TEST2

if QTY == 0 then ... it should not display, right? for example:

DAY4 || 0 || TEST2
Apr 25 '07 #4
Hi,
In the result set you may have some Quantitiy might be zero.So that two msgs will be displayed.If your desire out put is ,

whenever any one of the quantitity is zero then don;t display the form at all.
If this is the case then you can set the flag variable and assign the form to one variable.if the flag is set then display the msg otherwise display the form.

I think by this you can sort this problem.

Prasanna
Apr 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
8
by: drose0927 | last post by:
Please help! I can't get my program to exit if the user hits the Escape button: When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this error: Parse Error, expecting `'}''...
5
by: Jesee | last post by:
I am reading Jeffrey Richter's book "Applied Microsoft .NET Framework programming",i came across "Exception handing". Page 405 says "If the stack overflow occurs within the CLR itself,your...
11
by: Scott C. Reynolds | last post by:
In VB6 you could do a SELECT CASE that would evaluate each case for truth and execute those statements, such as: SELECT CASE True case x > y: dosomestuff() case x = 5: dosomestuff() case y >...
2
by: Greg Corradini | last post by:
Hello All, A few weeks ago, I wrote two scripts using mx.ODBC on an Access DB. Among other things, both scripts create new tables, perform a query and then populate the tables with data in a...
6
by: redashley40 | last post by:
This is my first attempt in SQL and PreparedStatement I have add the PreparedStatement and I'm not to sure if I'm doing it correctly. When I do a test run on Choose 1 ,or 2 I get this error. Error...
2
by: rookiejavadude | last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone...
0
by: RCapps | last post by:
When running the below SQL Query I keep getting the following error: Server: Msg 4924, Level 16, State 1, Line 1 ALTER TABLE DROP COLUMN failed because column 'ContractDef' does not exist in table...
2
by: kya2 | last post by:
I am not able to create following store procedure. CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT ) RESULT SETS 1 LANGUAGE SQL BEGIN part1 DECLARE TOTAL_LEFT INT DEFAULT 0; ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.