473,811 Members | 2,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query Question

I have a form with drop down menus to query for name, month, and year
to capture activity accordingly by an individual for a given month and
given year. But I'd like to also be able to query ALL individiduals
for a given month and year OR an individual for the whole year for
example.

My question, is there any way to have blank (not filled in) fields of
a query input ignored when left blank? I'm currently doing very
successfully what I described in the para above but it's taking me 3
queries (which I have on the same sheet for simplicity) to do it when
it would look a lot neater to have a single query and leave any drop
down menu items that I don't want to include on the query, blank and
ignored. Any ideas? TIA
Jul 17 '05
16 2740
Hi Chris

Funny thing is I have been working on a site (see all my recent posts)
where I have had to do something very similar, and I know how complicated
is gets very quickly.

Just for reference, you may want to look at adding some JavaScript to
your form that does some of the hard work for you, the form I have
been working on has something like 50 different queries that could be
made depending on what the user has sleeted, I found by using JavaScript
I could say if the user selects X then set Y to whatever. This way you
are only passing the info you really need.

Brian
Jul 17 '05 #11
I noticed that Message-ID: <6J************ ***@newsfe5-gui.ntli.net> from
Brian contained the following:
Just for reference, you may want to look at adding some JavaScript to
your form that does some of the hard work for you, the form I have
been working on has something like 50 different queries that could be
made depending on what the user has sleeted, I found by using JavaScript
I could say if the user selects X then set Y to whatever. This way you
are only passing the info you really need.


But you really should not rely on Javascript.

--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011
Jul 17 '05 #12
Hello Geoff,

This is definitely true.

JavaScript should only be used for the benefit of the client to provide
valid input.

Expect the unexpected. Any hacker can sent garbage data to your application.

Check input for length, type, range, format and remove garbage.

Get to understand Regular Expressions, They are your friend.

Write functions once that you can reuse to minimize your effort.
Joseph Melnick
JM Web Consultants
www.jphp.com


"Geoff Berrow" <bl******@ckdog .co.uk> wrote in message
news:gj******** *************** *********@4ax.c om...
I noticed that Message-ID: <6J************ ***@newsfe5-gui.ntli.net> from
Brian contained the following:
Just for reference, you may want to look at adding some JavaScript to
your form that does some of the hard work for you, the form I have
been working on has something like 50 different queries that could be
made depending on what the user has sleeted, I found by using JavaScript
I could say if the user selects X then set Y to whatever. This way you
are only passing the info you really need.


But you really should not rely on Javascript.

--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011

Jul 17 '05 #13

"Joseph Melnick" <jm******@jphp. com> wrote in message
news:x_******** ************@ro gers.com...
Hello Geoff,

This is definitely true.

JavaScript should only be used for the benefit of the client to provide
valid input.

Expect the unexpected. Any hacker can sent garbage data to your
application.

Check input for length, type, range, format and remove garbage.

Get to understand Regular Expressions, They are your friend.

Write functions once that you can reuse to minimize your effort.
Joseph Melnick
JM Web Consultants
www.jphp.com

I agree with what your saying, but for example the site I have been
working on recently required the user to select a 'store' or 'all stores'
My client asked for a tick box for all stores, and 2 drop down lists of
the store number or location.
By using JavaScript, if the 'all' box is ticked then set the 2 drop down
lists
to blank, if say the store location is selected then set the store number
and
tick box to blank, and so on.

This way when the form is submitted I can run various tests to see what
has been set, what to look for and what variables to use. The reason I have
done it this way is so I don't have to build a un-friendly user interface
that
would confuses the user.by select this if you want this, and that if you
want that
and so on.

I'm not saying that once the form has been submitted you should run Regular
Expressions on the incoming data, but this way you no what to run on what.
Brian

Jul 17 '05 #14
Hello Brian,

Yes you are correct. Using JavaScript for usability is valid.

You could have simplified this task with a single mullti-select without the
need for a checkbox.

<select name="locations " multiple>
<option value="99999" selected>All Locations</option>
<option value="89837">8 9837 - Smallville</option>
....
<option value="98374">9 8374 - Largerville</option>
</select>

Would simplify validation and reduce page real-estate.

Just a idea.

Have a great day.

Joseph Melnick
JM Web Consultants
http://www.jphp.com

I agree with what your saying, but for example the site I have been
working on recently required the user to select a 'store' or 'all stores'
My client asked for a tick box for all stores, and 2 drop down lists of
the store number or location.
By using JavaScript, if the 'all' box is ticked then set the 2 drop down
lists
to blank, if say the store location is selected then set the store number
and
tick box to blank, and so on.

This way when the form is submitted I can run various tests to see what
has been set, what to look for and what variables to use. The reason I
have
done it this way is so I don't have to build a un-friendly user interface
that
would confuses the user.by select this if you want this, and that if you
want that
and so on.

I'm not saying that once the form has been submitted you should run
Regular
Expressions on the incoming data, but this way you no what to run on what.
Brian

Jul 17 '05 #15
Built on machine and works fine:
PHP 5.0.4
Apache 2.0.53
MySQL Client API version 4.1.7

Running on a server with the code below hanging up unless it's
'remmed' out...:
PHP 4.1.1
Apache 1.3.23
MySQL Client API version 3.23.39

mysql_connect($ DBhost,$DBuser, $DBpass) or die("Unable to connect to
database"); // make connection to database
mysql_select_db ($DBName) or die("Unable to select database $DBName");
// select database
// if (mysqli_connect _errno())
// {
// echo 'Error: Could not connect to database. Please report this
problem.';
// exit;
// }
Everything on my form worked fine on my development machine with the
newer versions of PHP, MySQL, and Apache. When I ran it on the server
with older versions, my query hung up.

QUESTION: The part that specifically hangs is "if
(mysqli_connect _errno())" of which I have to think something is there
that wasn't in the older versions so... Does anyone know an
equivalent line that will work on the older PHP ??? TIA


Jul 23 '05 #16
Chris (Chris <coverland914 @ yahoo.com>) decided we needed to hear...
Built on machine and works fine:
PHP 5.0.4
Apache 2.0.53
MySQL Client API version 4.1.7

Running on a server with the code below hanging up unless it's
'remmed' out...:
PHP 4.1.1
Apache 1.3.23
MySQL Client API version 3.23.39

mysql_connect($ DBhost,$DBuser, $DBpass) or die("Unable to connect to
database"); // make connection to database
mysql_select_db ($DBName) or die("Unable to select database $DBName");
You don't need the code below in any case, since you have already
tested if your connection and database selection worked or not in
the lines above. However, you might wish to add the return value from
mysql_error() to the strings you output from die - that will
report the cause of any error more effectively.
// select database
// if (mysqli_connect _errno())
// {
// echo 'Error: Could not connect to database. Please report this
problem.';
// exit;
// }
Everything on my form worked fine on my development machine with the
newer versions of PHP, MySQL, and Apache. When I ran it on the server
with older versions, my query hung up.

QUESTION: The part that specifically hangs is "if
(mysqli_connect _errno())" of which I have to think something is there
that wasn't in the older versions so... Does anyone know an
equivalent line that will work on the older PHP ??? TIA


The mysqli library is seperate from the mysql library and provides
different (improved) functions - so you probably shouldn't be mixing
up using both sets of functions anyway - use one or the other, but
not both together. The reason the call doesn't work in the older
version of PHP is probably that its not compiled in or enabled.

--
Dave <da**@REMOVEbun dook.com>
(Remove REMOVE for email address)
Jul 23 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3409
by: majsen | last post by:
Hi, I have problem running this query. It will time out for me... My database are small just about 200 members. I have a site for swaping appartments (rental). my query should look for match in a triangle. Like this member A -> B->C A give his appartment to B. B gives his appartment to C and finally C gives his appartment to A Soo my query looks for matching parameters like rooms, location, size
8
3274
by: Együd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run simultaneously 4 similar queries it takes nearly 5 minutes instead of 4 times 9 seconds or something near of that. here is a sample query: select mertido, fomeazon, ertektipus, mertertek from t_me30 where fomeazon in (select distinct fomeazon...
3
14133
by: John Ortt | last post by:
> I have a table of dates in ascending order but with varying intervals. I > would like to create a query to pull out the date (in field 1) and then pull > the date from the subsequent record (and store it in field 2). > > I would like to run a query that returns all the data in the table plus the > record number, in a similar sense to the getuser() command to get the User's > Identity, I would like a GetRecord() command.
3
3096
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table before rowID answID qryrow questionID datafield 1591 12 06e 06e 06e question 1593 12 06f 06f 06f question 1594 12 answer to the question 06f
7
3394
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the database I am working on. IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL DROP TABLE REPORT_SELECTION
6
4853
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID SalesManName AT Alan Time
2
2045
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: Question ------------ QuestionID QuestionText Question_MediaTypeID
22
31214
by: Stan | last post by:
I am working with Access 2003 on a computer running XP. I am new at using Access. I have a Db with a date field stored as mm/dd/yyyy. I need a Query that will prompt for the month, ie. 6 for June, and will return all records in that month.
3
2067
by: Richard Hollenbeck | last post by:
I am very sorry about the (almost) re-post, but you will see that my first question wasn't very clear; I have another question I posted this morning called, "in DAO: Run time error 3061 Too few parameters...." I have read many articles on the web about how to make a dynamic report based on a cross-tab query. But for some reason mine never works right. First, my saved query's criteria is the data in an open form's combo box. So the...
16
3527
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for renaming the duplicate records? My thinking was to take the results of the duplicate query, and somehow have it number each line where there is a duplicate (tried a groups query, but "count" won't work), then do an update query to change the duplicate to...
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10393
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10124
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.