[PHP] Re: php/mysql Query Question.

2009-09-16 Thread Peter Ford
ad...@buskirkgraphics.com wrote: Before most of you go on a rampage of how to please read below... As most of you already know when using MySQL from the shell you can write your queries in html format in an out file. Example: shellmysql -uyourmom -plovesme --html This now will return

Re: [PHP] mySQL query question

2008-11-16 Thread Chris
Jim Lucas wrote: [EMAIL PROTECTED] wrote: Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially, then you are only modifying the confirm_number value and then re- submitting all the values, as they

Re: [PHP] mySQL query question

2008-11-16 Thread Jim Lucas
Chris wrote: Jim Lucas wrote: [EMAIL PROTECTED] wrote: Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially, then you are only modifying the confirm_number value and then re- submitting all the

Re: [PHP] mySQL query question

2008-11-15 Thread Jim Lucas
Michael S. Dunsavage wrote: On Fri, 2008-11-14 at 12:46 -0800, Jim Lucas wrote: SELECT @confirm_number AS confirm_number; Are we not SELECTING the column value here? should we be selecting confirm_number as confirm_number? The idea is to give you the number that was used in the INSERT

Re: [PHP] mySQL query question

2008-11-14 Thread Michael S. Dunsavage
On Fri, 2008-11-14 at 08:46 +0100, Jochem Maas wrote: 1000 + 1 != 10001 you might consider setting a default of 1000 or 1 or whatever on the given field so it's automatically populated with that number when a contact record is created. Sorry. Hit the 0 one to few times. -- Michael S.

Re: [PHP] mySQL query question

2008-11-14 Thread Thodoris
okay I want to pull an integer from a database called confirm_number, add 1 and repost it back to the database here's the code I'm using. $queryconfirm=SELECT confirm_number from contacts ORDER BY contact DESC LIMIT 1; I assume that you are already aware that if you set the variable

Re: [PHP] mySQL query question

2008-11-14 Thread Martijn Korse
I would create a separate table for this (confirmation_numbers or something) with an autoincrement primary key. That way you can simply insert a new record for you contact and then ask (using mysql_insert_id()) what the confirmation number is. This approach is much safer as you can be 100% sure

Re: [PHP] mySQL query question

2008-11-14 Thread Bastien Koert
On Fri, Nov 14, 2008 at 9:58 AM, [EMAIL PROTECTED] wrote: okay I want to pull an integer from a database called confirm_number, add 1 and repost it back to the database No, you don't want to do that. :-) You are introducing a race condition between TWO users who hit the same page at

Re: [PHP] mySQL query question

2008-11-14 Thread mikesd1
update contacts set confirm_number = confirm_number + 1 order by contact desc limit 1 Here is the php query I've been using to send the record in the first place $query=INSERT INTO contacts (first_name, last_name, email, phn_number, address, city, state, zip, dates, comments, confirm_number)

Re: [PHP] mySQL query question

2008-11-14 Thread Jim Lucas
[EMAIL PROTECTED] wrote: update contacts set confirm_number = confirm_number + 1 order by contact desc limit 1 Here is the php query I've been using to send the record in the first place $query=INSERT INTO contacts (first_name, last_name, email, phn_number, address, city, state, zip,

Re: [PHP] mySQL query question

2008-11-14 Thread Bastien Koert
On Fri, Nov 14, 2008 at 1:22 PM, [EMAIL PROTECTED] wrote: update contacts set confirm_number = confirm_number + 1 order by contact desc limit 1 Here is the php query I've been using to send the record in the first place $query=INSERT INTO contacts (first_name, last_name, email,

Re: [PHP] mySQL query question

2008-11-14 Thread mikesd1
Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially, then you are only modifying the confirm_number value and then re- submitting all the values, as they originally were, Well, actually when all is

Re: [PHP] mySQL query question

2008-11-14 Thread Jim Lucas
[EMAIL PROTECTED] wrote: Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially, then you are only modifying the confirm_number value and then re- submitting all the values, as they originally were,

Re: [PHP] mySQL query question

2008-11-14 Thread Jim Lucas
Jim Lucas wrote: [EMAIL PROTECTED] wrote: Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially, then you are only modifying the confirm_number value and then re- submitting all the values, as

Re: [PHP] mySQL query question

2008-11-14 Thread Michael S. Dunsavage
On Fri, 2008-11-14 at 13:31 -0800, Jim Lucas wrote: '{$Comments}', @confirm_number ) The above should be this instead @confirm_number ); Even after fixing that, nothing gets inserted into the database. I've been all

Re: [PHP] mySQL query question

2008-11-14 Thread Jim Lucas
Michael S. Dunsavage wrote: On Fri, 2008-11-14 at 13:31 -0800, Jim Lucas wrote: '{$Comments}', @confirm_number ) The above should be this instead @confirm_number ); Even after fixing that, nothing gets inserted into the

Re: [PHP] mySQL query question

2008-11-14 Thread Jim Lucas
Jim Lucas wrote: Michael S. Dunsavage wrote: On Fri, 2008-11-14 at 13:31 -0800, Jim Lucas wrote: '{$Comments}', @confirm_number ) The above should be this instead @confirm_number ); Even after fixing that, nothing gets

Re: [PHP] mySQL query question

2008-11-14 Thread Michael S. Dunsavage
On Fri, 2008-11-14 at 12:46 -0800, Jim Lucas wrote: SELECT @confirm_number AS confirm_number; Are we not SELECTING the column value here? should we be selecting confirm_number as confirm_number? -- Michael S. Dunsavage -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] mySQL query question

2008-11-13 Thread Micah Gersten
If you're just adding one, there is no reason to retrieve the data, process it, and update it. You can just update the number. http://dev.mysql.com/doc/refman/5.0/en/update.html Also, you should read the MySQL manual on default values:

Re: [PHP] mySQL query question

2008-11-13 Thread Michael S. Dunsavage
On Fri, 2008-11-14 at 00:52 -0600, Micah Gersten wrote: If you're just adding one, there is no reason to retrieve the data, process it, and update it. You can just update the number. http://dev.mysql.com/doc/refman/5.0/en/update.html But, the problem is that the confirm_number is a

Re: [PHP] mySQL query question

2008-11-13 Thread Jochem Maas
Michael S. Dunsavage schreef: okay I want to pull an integer from a database called confirm_number, add 1 and repost it back to the database here's the code I'm using. $queryconfirm=SELECT confirm_number from contacts ORDER BY contact DESC LIMIT 1; $confirmresult=$queryconfirm;

Re: [PHP] MYSQL Query question

2004-12-09 Thread Raditha Dissanayake
Reinhart Viane wrote: And a last question: I always seem to get stuck on mysql queries when scripting. mysql.com gives me a headache whens earching something. Does someone know a good mysql manual site or a good mysql book? That does not mean mysql questions should be posted on php mailing

RE: [PHP] MYSQL Query question

2004-12-09 Thread Reinhart Viane
To: [EMAIL PROTECTED] Subject: Re: [PHP] MYSQL Query question Reinhart Viane wrote: And a last question: I always seem to get stuck on mysql queries when scripting. mysql.com gives me a headache whens earching something. Does someone know a good mysql manual site or a good mysql book? That does

Re: [PHP] MYSQL Query question

2004-12-09 Thread John Nichel
Raditha Dissanayake wrote: Reinhart Viane wrote: And a last question: I always seem to get stuck on mysql queries when scripting. mysql.com gives me a headache whens earching something. Does someone know a good mysql manual site or a good mysql book? That does not mean mysql questions should be

Re: [PHP] MYSQL Query question

2004-12-09 Thread Raditha Dissanayake
John Nichel wrote: Raditha Dissanayake wrote: Reinhart Viane wrote: And a last question: I always seem to get stuck on mysql queries when scripting. mysql.com gives me a headache whens earching something. Does someone know a good mysql manual site or a good mysql book? That does not mean mysql

Re: [PHP] Mysql Query Question

2003-03-18 Thread CPT John W. Holmes
$string = ' . implode(',',$group) . '; $query = SELECT * FROM table WHERE groupname IN ($string); ---John Holmes... - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 3:51 PM Subject: [PHP] Mysql Query Question I am

RE: [PHP] Mysql Query Question

2003-03-18 Thread Van Andel, Robbert
Thanks, I knew it was something simple but I couldn't find it on the 'Net. Robbert van Andel -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 1:14 PM To: Van Andel, Robbert; [EMAIL PROTECTED] Subject: Re: [PHP] Mysql Query Question

Re: [PHP] MySQL query question

2002-01-24 Thread Erik Price
If you are using a table with AUTO_INCREMENT set for one of the fields, the default is for MySQL to assign any new row an AUTO_INCREMENT value that is one higher than the currently highest value in that column. In other words, MySQL by default does exactly what you say you are trying to do.

Re: [PHP] MySQL query question

2002-01-24 Thread Matt
If you're trying to be able to keep reference to the order the records are added to the table, simply add a date/time field and populate it with the date/time now() when you insert. You can then sort on that as needed later. - Original Message - From: Phil Schwarzmann [EMAIL PROTECTED]

Re: [PHP] MySQL Query Question

2001-04-15 Thread CC Zona
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Jeff Holzfaster") wrote: I have a couple questions... first, is there a notable MySQL General List like this one? Yes. The list on mysql.com is quite active and, like this one, it's common to get responses directly from one of the

RE: [PHP] MySQL Query Question

2001-04-15 Thread Jeff Holzfaster
The MySQL manual has a chapter on date/time factions. Or is it the 'order by' clause that's giving you trouble...? I assume that 'date' is a reserved word, so it may be confusing mysql. In which case, try using a different alias, like 'f_date". This works: select date_format(date,

Re: [PHP] MySQL Query Question

2001-04-15 Thread CC Zona
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Jeff Holzfaster") wrote: This works: select date_format(date, "%W, %e %M %Y") as date from table This doesn't: select concat(date_format(date, "%W, %e %M %Y")," ",time) as time_of_day I'm wondering if it is possible to use concat in this