Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Select Statement Where Time <= 5min Ago


i tried many different MySQL fucntions and looked through the MySQL manual, and it didnt help me any. What i want to do is select all rows from a table where my time column(DATETIME) is less then or equal to 5 minutes ago from now().




View Complete Forum Thread with Replies

Related Forum Messages:
Datatype TIME - Select Statement Format
The table I have has two columns of ID and INTERVALS. The INTERVALS is datatype TIME. Whenever I do a select I always get the table back showing the time in the format HH:MM:SS like for 11am I get back 11:00:00. I only want HH:MM like 11:00. How do I achieve this? I have tried to limit to 2 decimal places but that has not worked so far. ...

View Replies !
First And Last Time In Each Date By Empl (was "Help Me With This Select Statement")
I have the following table which has the following fields:

logid, empid, transdate,transtime

I want to select the first and last transtime in a specific date for every employee, how can i do that?

View Replies !
Would 'binary' Modifier In A Create Table Statement Lead To Longer Exection Time
a table tb_A is created as

Code:
create table tb_A (Word varchar(20) binary NOT NULL);or created as

Code:
create table tb_A (Word varchar(20) NOT NULL);
There is another table tb_B. It is created as

Code:
create table tb_B (Word varchar(20) binary NOT NULL);or as

Code:
create table tb_B (Word varchar(20) NOT NULL);
do the following query over tb_A and tb_B

Code:
SELECT
Word
FROM
tb_A, tb_B
WHERE
tb_A.Word = tb_B.Word;
I wonder if the binary modifier would cause longer execution time?

View Replies !
Select Statement Question (nested Select?)
I have a DB containing 3 fields fullname, inext, and outext. I need to see all the records that have a duplicate entry in inext. I know I can do a distinct query on the inext column but that only gives me the unique ones I need all the different duplicate records.

View Replies !
Combining SELECT Statements Into One SELECT Statement.
I want to take the results from:

SELECT name.empnumber, name.firstname, name.lastname
FROM name INNER JOIN authuser
ON name.empnumber = authuser.uname AND authuser.team = 'PHQ'
ORDER BY name.lastname, name.firstname;


and the results from:

SELECT name.empnumber, name.firstname, name.lastname
FROM name INNER JOIN crew_attendance_6QJ
ON name.empnumber = crew_attendance_6QJ.empno
ORDER BY name.lastname, name.firstname;


And combine them into one query that outputs all of the results both queries would output. Then order those results.

So far I have come up with:

View Replies !
Select 1st 20 Words In Select Statement
Table name:- Customer
Column name:- Custbiodata

View Replies !
Select Statement!
I have a simple query that is similar to this one:

SELECT distinct b.username from permissions a, users b, links c where
a.user_id = b.id and c.information = 14;

In this case, it selects the all users details from table 'user' that are
permissioned to access a certain information with id = 14.

The problem is that I need to select the users that are not permissioned but
I have sql v3.23 and I canot use union.

In other words, I need to do a select b.username from users b where
b.username not in "the result" of the last select.

View Replies !
One Select Statement
I have a table with the fields

id | titleid | catid

Each title can have more than 1 catid so it's possible for the fields to look like this:

id | titleid | catid
1 1 1
2 1 2
3 2 1

Now I want to select any rows where titleid matched more than one catid. In this example I would like to select titleid 1 because it is in catid 1 and catid 2 but I can't seem to figure out a statement that properly says
"give me any titleid that has a catid of 1 AND a catid of 2"

View Replies !
SELECT Statement With OR
I need some help with this select statement:

SELECT * FROM gallery
WHERE type = 'skate'
AND park = 'Both' OR park = 'Park 1'

I just need it to look at one table and grab all the rows that have a type of 'skate' and have a park value of either 'both' or 'milwaukee'.

I think the OR is throwing it off.

View Replies !
Regarding Select Statement
I am retrieving data from two tables using the UNION statement and i am thinking of having a field in my resultset(this field is not found in the database) to distinguish the data from two tables.Is it possible to set a fixed value for a particular field using the select statement?For example, a field value of 'buy' and 'sell' values are used to distinguish between the two tables.

View Replies !
Select And A Max In The One Statement
Can you combine a select and a max in the one select statement?
Eg,. I want to select like

select ids from table_name where ids > $idsvariable... order by ids....

but I also want to grab the highest ids number so I can put $idsvariable (max) into a table so next time it selects only the ids higher than the last time the select was run!

So if ids were:

2
5
6
9
12
14
15

then I'd like to get 15 as the max as well...
any examples.

View Replies !
Select Nav Statement
I have a nav table in my database that grabs information to put into the navi menu, this is dependant on user access etc...
i have an item in my table that is in zone "members" and it is marked for permission Z.
Although when i run the query it dont pick it up.... these are the queries that ive tried...

SELECT * FROM acwe_nav WHERE privs LIKE '%A%B%C%D%E%F%X%Y%Z%' AND zone='members' ORDER BY weight;

SELECT * FROM acwe_nav WHERE privs LIKE '%ABCDEFXYZ%' AND zone='members' ORDER BY weight;

View Replies !
Else If In Select Statement
i have a bunch of records that i want to pull on the basis of eg

SELECT lat, lng, html, label, icontype FROM ade WHERE icontype='" . $_POST['name'] . "'";

but i'd like to make the first query and also another on an "if else" basis to cover various bases

if i post a query where the 'name' isnt an icontype, i want it to look in the "section" field and pull those records matching a certain value ie all records that have a value of "5"

is it possible to do something like this

SELECT lat, lng, html, label, icontype FROM ade where icontype='" . $_POST['name'] . "' ELSE IF section='" . $_POST['name'] . "' ELSE IF catid='" . $_POST['name'] . "'";

View Replies !
Is There Something Like A SELECT ALL BUT Statement?
Usually the tables I have to handel have a high number of columns. Additionally, columns are deleted and added dynamically. Most calls made on these tables are select statements:

Consider two tables t1 and t2. A natural join results in the columns a,b,c,d,e,f,g,h,z. A usual select statement is the following:

SELECT a,b,c,d,e,f,g,SUM(z) FROM t1 NATURAL JOIN t2 GROUP BY a,b,c,d,e,f,g

This way the column h could be "eliminated". As you can see the select and the group by clause can become fairly long. What I am looking for is a clever way to say "Group by everything but h and z". Is that possible?

View Replies !
Select Statement MIN()
SELECT *
FROM Distance, LorryDetails
WHERE cavan = (Select min (cavan) From Distance where cavan>0);

here is the results i am getting

source ,Cavan, Athlone, Cork, Galway ,LorryID, LorryReg, Position
Athlone 90 0 180 80 3 02-CN-8001 Cork
Athlone 90 0 180 80 7 00-CN-1000 Cavan
Athlone 90 0 180 80 10 02-G-8001 Galway

What i want to try and do is compare the Values with the Column names and get the shortest path. for example when you compare the position cort with the column cork it is 180, cavan is 90, and galway is 80. Galway is the nearest to athlone so i want to narrow down the results to just give me back the row where the position is equal to Galway. Can anyone help me with this.

View Replies !
Select Statement Within Another?
Tag_id::Img_id::Tag::counter
001::1::Tree::70
002::2::Tree::50
003::3::Pond::30
004::4::Flower::20
005::5::pink::60

lets say the above is my table.

this is my current query:

SELECT tag, max(counter) FROM tags GROUP BY tag DESC limit 3

this is the result I get:

tree 70
pond 30
pink 60

here is can someone pls tell me a way to get the total of the counter of all the occurrences of a particular tag(than the max(counter) ).

so that it'l be

tree 120
pond 30
pink 60

View Replies !
SELECT With An AS Statement
I'm using a LEFT JOIN to mash two tables together. It works fine.

I'm feeding this result into PHP's mysql_fetch_assoc. mysql_fetch_assoc doesn't handle columns with duplicate names very well, and these two tables do have duplicate names. So, I am using AS to assign an alias to these duplicate column names. But, these tables have about 20 fields each, and I can't figure out how to use my SELECT statement so that it selects all of the fields from tables (SELECT * FROM . . . ) but also assigns an alias to a specific field.

View Replies !
SELECT MIN, MAX And IF Statement
I have a few entries with a start timestamp, and an end timestamp. What I'd like to know is the earliest start date, and the latest end date, to define the complete time span of the selected entries.

Example: id, date_start, date_end:

1, 0000-00-00 00:00:00, 2009-02-07 12:00:00
2, 2009-01-01 12:00:00, 2009-01-05 12:00:00
3, 0000-00-00 00:00:00, 0000-00-00 00:00:00

As you can see, it's possible that a start_date and/or end_date aren't inserted. If I now select the MIN(start_date) and the MAX(end_date) from the above entries:

SELECT MIN(start_date) AS start, MAX(end_date) AS end FROM entries WHERE ...

The result is:
start = 0000-00-00 00:00:00
end = 2009-02-07 12:00:00

What I'd like to return, is the lowest possible date_start, in case a date_start has been entered. In the example above, this would be 2009-01-01 12:00:00, because that's the only date_start that isn't NULL. I tried this:

SELECT IF(start_date>0, MIN(start_date), NULL), etc...

View Replies !
SELECT With IF Statement(?)
# Table structure for table `db_emails`
#

CREATE TABLE `db_emails` (
`id` int(10) NOT NULL auto_increment,
`user_id` int(10) NOT NULL default '0',
`email` varchar(255) NOT NULL default '',
`main` int(1) NOT NULL default '0',
`list` int(2) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

#
# Dumping data for table `db_emails`
#

INSERT INTO `db_emails` VALUES (1, 1, 'a.a@a.se', 1, 1);
INSERT INTO `db_emails` VALUES (2, 1, 'aa.aa@a.se', 0, 2);
INSERT INTO `db_emails` VALUES (3, 2, 'b.b@b.se', 0, 1);
INSERT INTO `db_emails` VALUES (4, 2, 'bb.bb@b.se', 0, 2)

So, now to my question. How can i do a SELECT where i want all email adresses BUT only the main if main=1 and all if main=0. The result for this dataset should be:
a.a@a.se
b.b@b.se
bb.bb@b.se

View Replies !
Select Statement
How can I do a select statement for this problem:

If a in ('1', '6', '11', '16', '21', '26', '31', '36', '41', '46', '51', '56') then '1' as ‘stemp’

If a in ('2', '7', '12', '17', '22', '27', '32', '37', '42', '47', '52', '57') then '3' as ‘stemp’

If a in ('3', '8', '13', '18', '23', '28', '33', '38', '43', '48', '53', '58') then '5' as ‘stemp’

If a in ('4', '9', '14', '19', '14', '29', '34', '39', '44', '49', '54', '59') then '7' as ‘stemp’

If a in ('5', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55', '60') then '9' as ‘stemp’

I have this possibilities as a result.

View Replies !
Select Statement
I have a table containing names of people in the neighborhood. The table only contains first name and family names.
How to get lists of first names grouped by the same family name ?
This is similar to getting "sum" of salary grouped by a certain condition. Unfortunately, "sum" does not work for strings.

View Replies !
Need Help With SELECT Statement
I have 2 simple tables: emps and rprts.
Table emps has: "ID", "name" (simple string), and some other irrelevant fields.
Table rprts has: "ID", "emp_id" (indication of "ID" in emps table), "rprt" (10-digits time), and "type" (boolean).

I want to select the fields "ID" and "name" from emps, and in addition - for every selected row I want to select rprts's "type", where "rprt" (or "id", doesn't matter) value in the highest.

For example:
emps:
id name
------------------
1 jeff
2 wanda
3 brad

rprts:
id emp_id rprt type
-------------------------------------------
1 3 df 1
2 1 ie 1
3 2 ei 1
4 3 fd 0
5 2 tg 0
6 3 gf 1
For this data, the following should be selected:

id name type
----------------------------
1 jeff 1
2 wanda 0
3 brad 1

I tried several things, but I want to keep it simple and readable, so I'll understand if I'll read it sometime in the future.

View Replies !
Help Me With This Select Statement :)
I have two tables
1- articles table which contains the articleid and article_description
2- articles_translation table which contains translation_id, article_id(foreign key from the articles table) and translation_description

I would like to select all the articles which aren't translated yet... How can i do this in MySQL?



View Replies !
Is Null Clause Takes A Lot Of Time But Is Not Null Statement Not
i have a query which takes 1 and half minute to fully execute. This query is following which return 2 records

select o.id, o.number, o.timest, o.receiptno, o.canedit, o.sessionid, o.voidorder, o.cashchange,p.amount from orders o left join payments p on (o.id=p.oid) where p.amount is null

but if i remove the 'not' from where clause then it takes a fraction of seconds. query is following which takes fraction of second and it returns 3920 records

select o.id, o.number, o.timest, o.receiptno, o.canedit, o.sessionid, o.voidorder, o.cashchange,p.amount from orders o left join payments p on (o.id=p.oid) where p.amount is not null

View Replies !
Add Time Using A Select Query
Hello, how can I add, say, 2 hrs from a time in a database using a select query. I have searched the forums but cannot find an answer. Is it possible PHP Code:

 select 
date,
`time`                         as timetime
     , time_format(`time','%l:%i %p') as Printtime,
client,
address
from.......... 

View Replies !
Select Between Date And Time
I have field date and time respectively. I want to select date between (date1 and time1 > 17) and (date2 < 17)

I tried two ways but doesn't work, please see code below.
SELECT * from purchases_suppliers WHERE (date_invoice >= '2009/02/25' and time_invoice > 17) AND (date_invoice <= '2009/02/27' AND time_invoice < 17)

SELECT * from purchases_suppliers WHERE date_invoice between ('2009/02/25' ANd time_invoice > 17) AND ('2009/02/27' AND time_invoice < 17 )

View Replies !
Update And Select Same Time
Code:

UPDATE art SET art.art_writer = (SELECT writer.writer_name, art.art_author FROM writer, author WHERE art.art_author LIKE 'writer.writer_name')

Is this query syantex is ok ?

Where, art_writer is empty fild where I want to put correct value which is in writer table and it should similar to value in art_author filed.

View Replies !
SELECT With TIME INTERVAL
I have in my database a table with this structure:

id, latitude, longitude, speed, userid and Timestamp....

View Replies !
Select Statement In Normalized Db
can anyone share the best way to retrieve from a normalized db? My goal
is to get the engines.eng_definition. Here's what I have:

thehub: 1N
---------
1)item_no

carinfo: 2n
----------
1)item_no
2)eng_ID

engines: 3n
----------
1)eng_ID
2)eng_definition

my query has to get the item number from theHub. Is there a way for me
to JOIN these together? I understand how to do a JOIN on theHub and
carinfo but can I join engines in the same select statement?
right now this is what I have. Keep in mind there are other items
being retrieved.

Select x, y, z
FROM thehub INNER JOIN carinfo ON (thehub.item_no = carinfo.item_no)

View Replies !
Logs Via Select Statement
I know then when I am using MySQL via the command interface, I can press the up arrow to scroll through previously typed statements. Is this information stored somewhere that can be accessed via log file or via a select statement? Is this available for all accounts?

View Replies !
Select And Update Statement
Is it possible to combine a select and update statement in mysql? If
so, what is the syntax.

View Replies !
Select Statement Needed
The sending page allows the user to choose which search criteria he
wants, so this (and many other) pieces of the select statement may or
may not be present. The statement always starts with

SELECT * from logdata where driver = '$_COOKIE[username]'

If the user has selected them and supplied the proper data for a search,
other elements will be added to the query string. For example, it may
look like

SELECT * from logdata where driver = '$_COOKIE[username]' AND amount >=
$_POST[txtLowAmount] AND amount <= $_POST[txtHighAmount] AND restaurant
regexp???

I'm not even sure if that is where a regexp belongs or if that is how it
should be used.
Ultimately, I would prefer it be non case sensitive.
Here are some examples of what I want:

If the user string is "CHIL"
Chili'strue
Charlie'sfalse
CHILtrue
chfalse

View Replies !
Concat In Select Statement
Is it possible to conduct a test in the select statement to see if a value is not found in one table (t2) then get the value from another table (t3).

In this case you would have 3 tables.

if there is no related record in table2 t2, then get the value from table3 t3

If so what would the code look like? .....

View Replies !
SQL Statement To Select Only One Name From A Lot Of Same Names
I have SQL statement like "Select Fullnmae from abssubtest" and if I do so the output is the list of all data containing in the Fullname...including the data with same names is repeating...I dont want the repeated data...i.e. if the Fullname data has

1. Ulm

2. Prague

3. Frankfurt

4.Prague

5. Frankfurt I want the output as only

1.Ulm

2.Prague

3.Frankfurt

but not the repeated city names...

View Replies !
IF Statement Within A Select Query?
If there a way to do an IF statement within a MySQL select query? I have this query that gets a vendor's code and name from the database and CONCAT it to put the code into "()" and add the vendor name to the end. Is there a way to write it so the "()" will not be included if the vendor does not have a code set.

View Replies !
SELECT Statement For Most Submission
I have a users field in a posts table that I want to select the 3 users that have made the most submissions. I'm having trouble coming up with a select statement that will work. Can someone point me in the right direction?

View Replies !
Nested Select Statement
I am working on a feature for my website (MyRoladex.com) where i have a script run through the database once per hour, look to see who has events scheduled that are within the next hour, then look to see what their email/sms/text message preferences are, then email/text them a notification that it is close to time for their scheduled event.

Under the Accounts table, i have 5 notable fields: uid, email, mobile, timezone, messagetype

Under the DatebookEvents table, the important field is, eventdate (besides 'uid', obviously), which is is YYYY-MM-DD HH-mm-SS format.

I did not want to calculate the time zone difference for each user, and then compare it to each of the event dates, and then to the system time, just to see if a notification should be sent, as this would be an immense waste of cpu and bandwidth. The next best thing that i though of was to STORE the event date PLUS or MINUS the time zone difference, whenever the user creates a new event, and then, whenever the user displays their events, it would ADD or SUBTRACT the time zone to the event date, so that it will display correctly for them, AND when the cron job runs once every hour, it will ONLY have to compare the eventdate field with the system time. This is better because the cron job will run once per hour, and have to work with, perhaps, thousands of records, whereas a user may only display his records once or twice per day, thus saving cpu and bandwidth overhead

When i was writing the query for the displaying of event details, where i take the event date for the entry they are viewing and ADD or SUBTRACT their time zone to it so that it displays properly according to their time, i came across this problem:

Select eid,(eventdate + hour(select Accounts.timezone from Accounts where Accounts.uid='666')),left(note,40) from DatebookScheduler where uid='666'

Returns:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select Accounts.timezone from Accounts where Accounts.uid='666')),left(note,40) ' at line 1

View Replies !
SELECT Statement For Area
I am trying to search a table with a statement like the following:

"SELECT name FROM table WHERE state='$state' AND trigger=1 AND areaA='$area' OR areaB = '$area'";

The problem is I need it to find the 'area' value in one of two different columns while matching the 'state' and 'trigger'. My syntax seems to be incorrect and I dont know how to find matching for 2 values while the other 2 columns can be optional, but one must be found.

View Replies !
Show In A Select Statement
is there any way to add "show ..." in a select statemnt? like "select ... union show status" ?

View Replies !
Optimize Select Statement
I have a big simple table with 3 fields and 700,000 records.

Table: mytable
Field1 Field2 Field3
name1 initial1 1
name2 initial2 0
name3 initial3 0
name4 initial4 0
... ... ...

i like to be able to do a fast search where it can return the first record that has 0 in field3. If i go through the whole table, it takes too long.

Select * from mytable where field3 = 0; <---- it takes too long to do this

i would like to get the record # 2 because this is the first record that field3=0

View Replies !
Using A Select Statement As A Wildcard
Is there a way to use a sub-query in a wildcard context?

I need to reference a field in one table as a search query in another but where the content of the second could exists anywhere in the first.

where t1.f1 like '%t2.f2%'

I fully appreciate that the above does not work but is there a way that the reference can be enclosed in a wildcard type statement?

An example of content:
t1.f1 = '123456 ABC1234/09' and t2.f2 = 'ABC1234'

If doing a sub query or join how can one acheive a match on the above?

View Replies !
Result Of SELECT Statement For IF/THEN?
What I am trying to find out if - if I do a SELECT FROM and there are NO results, is there a return code or variable to look at / compare in order to print out a message that the user does not exist?

SQL Statement is:
SELECT FROM subscribers WHERE (username='".$user1."' AND userpass='".$pass1."')

Then I would like to have an IF statement that interrogates something that would be 0 or null if there were no records found on the select.

View Replies !
Select Statement With Date
Basically My events lister page sends a query to my database and so far i have it returning my event(s) in order of startDay and displaying events in the future.

$query='SELECT * FROM events WHERE startDay >= CURRENT_DATE ORDER BY events . startDay ASC LIMIT 0, 30 ' ;

I now want to display the current events for the current month. I guess I would have to use AND but am unsure of how to to actually filter out the current month.

Would this be better done in php? I had a similar problem with the DATE_FORMAT function as i was trying to convert the dates to a European format. I eventually used php to convert the dates instead.

View Replies !
Trouble With SELECT Statement
I start to work with MySQL to store infos of my private group of dancers. There I have different tables (personen, addresses, emails, phones, urls)

I like to display the infos for all members of this group on a website (php & mysql), but I have trouble with my MySQL statement :

SELECT DISTINCT
concat(firstname," ",name) AS Mitgliedsname,
concat(area,"-",number) AS Telefonnummer,
mail_address AS 'Email-Adresse',
concat(street," ",houseno,", ",zipcode," ",city) AS Anschrift
FROM personen
LEFT JOIN phones ON phones.owner = personen.id
LEFT JOIN emails ON emails.owner = phones.owner
LEFT JOIN addresses ON addresses.owner = emails.owner
WHERE personen.status="Active"
ORDER BY Mitgliedsname;

Some of the members have more than one emailaddress and more than one phonenumber. So when I use the sql statememt above I got multiple combination of some members. here an example of the sql result:

Hans 8386884 hans@web.de Street 18, D-11111 Munich
Hans 7927678 hans@web.com Street 18, D-11111 Munich
Hans 751036 hans@web.net Street 18, D-11111 Munich
Hans 7927678 hans@web.de Street 18, D-11111 Munich
Hans 751036 hans@web.com Street 18, D-11111 Munich
Hans 8386884 hans@web.net Street 18, D-11111 Munich
Hans 751036 hans@web.de Street 18, D-11111 Munich
Hans 8386884 hans@web.com Street 18, D-11111 Munich
Hans 7927678 hans@web.net Street 18, D-11111 Munich

Does anyone of you have an idea how I can solve this?

View Replies !
Select Statement Where Clause
Does MySQL support "==" in the where clause, or is an exact match the default behavior?
I noticed the following select statement in existing code:
***********************************
$q = "SELECT
account_id, account_username, account_email, account_password, account_status
FROM account i
WHERE (upper(account_username) = $tcName)";
***********************************
I would have expected two records matching for the following situation:
$tcName = "BECK",
with a record having account_username = "BECK" and
a record having account_username = "BECKER"

It only returned a single record ("BECK"). The account_username is a varchar - does that make a difference? Are there any MySQL settings which control "exact on"?

View Replies !
SELECT Statement With MAX() Function
I am trying to select some ids from my database based on an effectiveDate. Here is a query similar to the one I'm using:

SELECT id, MAX(effectiveDate)
FROM mytable
WHERE effectiveDate<='today'
GROUP BY company, state;

This returns the correct effectiveDate, yet it does not return the id cooresponding to that date. Is there any way to make that happen in a single query?

View Replies !
Cannot Get Select Statement To Work
I can't for the life of me figure out why my select statement will not retrieve the data from MySql. it is a very simple statment;

mysql_query ("SELECT pub_type, call_number, pub_author, pub_title, subtitle, edition, publisher, publication_year, physical_description, series, isbn, holdings, subjects FROM library WHERE id=" .$pub_id);

but when I try to echo any of these variables I get nothing showing for results. the $pub_id displays because it is set by a GET function.

echo "<b class='foo'>$pub_id $pub_author $series </b> ";

I use a select statement on the page that calls for this page and it retrieves info from the database not problem... my includes for database connection, etc are all in tact.

View Replies !
Double WHERE In A Select Statement
hey having a bit of trouble wit my SELECT statement because i can't two WHERE statements to works Can anyone help
int uu = 3;
String code = "SELECT * FROM destinations INNER JOIN holidayType ON holidayType.holidayID = destinations.holidayID WHERE holidayType.star = uu && holidayType.season = '" + line + "'";

View Replies !
MySQL/PHP Select Statement
I'm trying to use this select statement:

$result = mysql_query('SELECT * FROM Accounts WHERE user LIKE $user');

for a login script. but i get keep getting this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/traumati/public_html/six/conntemp.php on line 17

can anyone tell me what i'm doing wrong? i asume it's something wrong with the syntax..

View Replies !
Select + Update In One Statement
I have these statements.

$selectdata = "SELECT * FROM imagetrack WHERE fimsid = ".$_GET["fimsid"]." AND name = '".$_GET["service"] . "'";

$query = mysql_query($selectdata) or die(mysql_error());
$update = "UPDATE imagetrack SET seen = seen+1 WHERE fimsid = ".$_GET["fimsid"]." AND name = '".$_GET["service"] . "'";

Basically i was wondering if there was a statement where i can select everything and update the seen in one statement.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved