473,320 Members | 1,699 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,320 software developers and data experts.

text comparison

Hi, I'm having a problem with one query. My database has the following
fields: id(int), time(int), and groupfield(enum - 5 possibilities). I
want to select all the rows where the time is between let's say 12 and
24 and the group is specified by the user using a html drop list. The
variable is named $group. Please help me to write that query. Thanx in
advance. Here's some part of the code for convenience:

<?php
if($group != "" && $group != "nic")
{
$link=mysql_pconnect("localhost", "t00c00l", "") or die ("cannot
connect");
mysql_select_db ("t00c00l_uk_db") or die ("Problem w/ database");
// and below is my problem... how to add the condition about the
right group
$query2="SELECT * FROM pareto WHERE (time<=24 && time>12)";
$result2=mysql_query("$query2") or die ("No luck this time");
$array[]= mysql_num_rows($result2);
mysql_free_result($result2);

mysql_close($link);
}
else
{
?>

<form action="<? echo $PHP_SELF; ?>" method="post">
<BR><BR><BR>
GRUPA: <BR>
<select name="group">
<option selected value="nic">-----
<option value="aaa">aaa
<option value="bbb">bbb
<option value="ccc">ccc
<option value="ddd">ddd
<option value="eee">eee
<option value="fff">fff
</select>
<input type="submit" value="GO">
</form>
<?
}
?>
Jul 20 '05 #1
1 2072
sks
Something simple like

select * from table where time >= 12 and time <= 24 and group=XXX

Hi, I'm having a problem with one query. My database has the following
fields: id(int), time(int), and groupfield(enum - 5 possibilities). I
want to select all the rows where the time is between let's say 12 and
24 and the group is specified by the user using a html drop list. The
variable is named $group. Please help me to write that query. Thanx in
advance. Here's some part of the code for convenience:

<?php
if($group != "" && $group != "nic")
{
$link=mysql_pconnect("localhost", "t00c00l", "") or die ("cannot
connect");
mysql_select_db ("t00c00l_uk_db") or die ("Problem w/ database");
// and below is my problem... how to add the condition about the
right group
$query2="SELECT * FROM pareto WHERE (time<=24 && time>12)";
$result2=mysql_query("$query2") or die ("No luck this time");
$array[]= mysql_num_rows($result2);
mysql_free_result($result2);

mysql_close($link);
}
else
{
?>

<form action="<? echo $PHP_SELF; ?>" method="post">
<BR><BR><BR>
GRUPA: <BR>
<select name="group">
<option selected value="nic">-----
<option value="aaa">aaa
<option value="bbb">bbb
<option value="ccc">ccc
<option value="ddd">ddd
<option value="eee">eee
<option value="fff">fff
</select>
<input type="submit" value="GO">
</form>
<?
}
?>

Jul 20 '05 #2

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

Similar topics

2
by: Indra Heckenbach | last post by:
I have recently come across an unusual behavior with Postgres 7.3.4 on a Linux RH 9 system. My database has encoding set to "UNICODE", and the table includes Japanese text. I'm trying to issue a...
1
by: Linda | last post by:
Hi, Is there a way to do a "text" (rather than "binary") compareison with the "like" operator, without changing the global "Option Compare" setting? I don't want to risk breaking many, many...
37
by: spam.noam | last post by:
Hello, Guido has decided, in python-dev, that in Py3K the id-based order comparisons will be dropped. This means that, for example, "{} < " will raise a TypeError instead of the current...
4
by: mflll | last post by:
I am looking into the different techniques of handling arrays of edit boxes in Java Script. The first program below works fine. However, are there better ways of doing this, where the person...
25
by: electrixnow | last post by:
in MS VC++ Express I need to know how to get from one comma delimited text string to many strings. from this: main_string = "onE,Two,Three , fouR,five, six " to these: string1 =...
8
by: John | last post by:
Hi I need a auto-number field but with a letter prefix like "P1", "P2" etc. What is the way to achieve this? Is it possible to do this at table level? Thanks Regards
8
by: addoty | last post by:
We have a web application that has a lot of large textareas for data collection. We need to track who makes changes, when and what changes were made. Right now I'm storing the entire text in a...
2
by: Justin Fancy | last post by:
Hi Everyone, I am creating a vb.net application, and i'm almost done. Except for one problem. I need to be able to change this output: C:\Documents and Settings\fancyj\My Documents\Visual...
7
by: Alan | last post by:
Hi. I have programmed in C++ before, but I`m a couple of years out of practice. I am seeking some advice on getting started on a quickie project. . . . I have to read a 54MB text file and do a...
1
risk32
by: risk32 | last post by:
Hello. I'm trying to open a file for comparison to two (2) input box text values. ie: txtPassword.text + ";" + txtUsername.text must equal whats in a line in the UNPW (username password) text file...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.