On Mon, Sep 19, 2011 at 04:00, Hank hes...@gmail.com wrote:
I agree with Brandon's suggestions, I would just add when using numeric
types in PHP statements where you have a variable replacement, for instance:
$sql=INSERT into table VALUES ('$id','$val');
where $id is a numeric variable in
On Mon, Sep 19, 2011 at 07:47, Reindl Harald h.rei...@thelounge.net wrote:
what ugly style - if it is not numeric and you throw it to the database
you are one of the many with a sql-injection because if you are get
ivalid values until there you have done no sanitize before and do not here
what ugly style - if it is not numeric and you throw it to the database
you are one of the many with a sql-injection because if you are get
ivalid values until there you have done no sanitize before and do not here
It's a matter of opinion. I never said the data wasn't sanitized (it is).
Am 19.09.2011 16:55, schrieb Hank:
what ugly style - if it is not numeric and you throw it to the database
you are one of the many with a sql-injection because if you are get
ivalid values until there you have done no sanitize before and do not here
It's a matter of opinion. I never said
On Mon, Sep 19, 2011 at 18:11, Reindl Harald h.rei...@thelounge.net wrote:
it is not because it is clear that it is sanitized instead hope and pray
thousands of layers somewhere else did it - for a inline-query the best
solution, if you are using a framework you will never have the insert into
Best of both worlds:
$username=$_POST['username'];
// do some stuff with username here
$M=array(); // Array of things to be inserted into MySQL
$M[username]=mysql_real_escape_string($username); // Everything that
goes into $M is escaped
$query=INSERT INTO table (username) VALUES
On Tue, Sep 20, 2011 at 01:11, Hank hes...@gmail.com wrote:
Best of both worlds:
$username=$_POST['username'];
// do some stuff with username here
$M=array(); // Array of things to be inserted into MySQL
$M[username]=mysql_real_escape_string($username); // Everything that
goes into $M is
Am 20.09.2011 00:39, schrieb Dotan Cohen:
On Tue, Sep 20, 2011 at 01:11, Hank hes...@gmail.com wrote:
Best of both worlds:
$username=$_POST['username'];
// do some stuff with username here
$M=array(); // Array of things to be inserted into MySQL
I want to be sure that all variables in the query are escaped. I don't
trust myself or anyone else to do this to every variable right before
the query:
$someVar=mysql_real_escape_string($someVar);
But you're doing exactly that right before the query anyway with:
On Tue, Sep 20, 2011 at 02:09, Hank hes...@gmail.com wrote:
I want to be sure that all variables in the query are escaped. I don't
trust myself or anyone else to do this to every variable right before
the query:
$someVar=mysql_real_escape_string($someVar);
But you're doing exactly that
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote:
i would use a samll class holding the db-connection with insert/update-methods
pass the whole record-array, lokk what field types are used in the table
and use intval(), doubleval() or mysql_real_escape-String
so you
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote:
i would use a samll class holding the db-connection with insert/update-methods
pass the whole record-array, lokk what field types are used in the table
and use intval(), doubleval() or mysql_real_escape-String
By the
Am 20.09.2011 01:23, schrieb Dotan Cohen:
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote:
i would use a samll class holding the db-connection with
insert/update-methods
pass the whole record-array, lokk what field types are used in the table
and use intval(),
fields in quotes as well, although it is
not necessary:
UPDATE mytable SET int_field = '5' WHERE id = '3';
On 9/18/11 5:00 AM, Dotan Cohen wrote:
I am somewhat confused as to the proper way to place quotes around
arguments in INSERT and SELECT statements. I also don't see where this
is made explicit
On Sun, Sep 18, 2011 at 17:44, Brandon Phelps bphe...@gls.com wrote:
Personally I don't use any quotes for the numeric types, and single quotes
for everything else. Ie:
Thanks, Brandon. I understand then that quote type is a matter of
taste. I always use double quotes in PHP and I've only
On Sun, Sep 18, 2011 at 12:28 PM, Dotan Cohen dotanco...@gmail.com wrote:
On Sun, Sep 18, 2011 at 17:44, Brandon Phelps bphe...@gls.com wrote:
Personally I don't use any quotes for the numeric types, and single
quotes
for everything else. Ie:
Thanks, Brandon. I understand then that
Am 19.09.2011 03:00, schrieb Hank:
I agree with Brandon's suggestions, I would just add when using numeric
types in PHP statements where you have a variable replacement, for instance:
$sql=INSERT into table VALUES ('$id','$val');
where $id is a numeric variable in PHP and a numeric field
Dear All
I'm trying to insert a bunch of data from TableA in TableB by doing
SELECT INTO TableB (fieldA, fieldB, ...)
SELECT fieldA, fieldB, ... FROM TableA GROUP BY fieldA, fieldC, ...
ON DUPLICATE KEY UPDATE fieldZ = VALUES(fieldZ);
On my PC this works fine. But on the Server, not all rows
Description:
copying a table with a fulltext index via
insert into ft1 select * from ft2;
into a identical table sometimes leads to select error 1191
when concurrent select's are running.
this happens in an enviroment where the searched table
Hi,
I have a table LOCAIS with:
id typedesc
1 t1 blah blah
2 t1 uihuih
3 t2 pokpokp
I want to list only the distinct types and create a table with those
results.
I know how to list the
This may help you:
mysql create table locais(
- id int,
- type varchar(2),
- `desc` varchar(10));
Query OK, 0 rows affected (0.12 sec)
mysql select * from locais;
+--+--+---+
| id | type | desc |
+--+--+---+
|1 | t1 | sk|
|2 | t2 | dsk |
|
INSERT INTO ztipos (type) VALUES (SELECT DISTINCT type FROM locais)
?
-afan
Miguel Vaz wrote:
Hi,
I have a table LOCAIS with:
idtypedesc
1t1blah blah
2t1uihuih
3t2pokpokp
I want to list only the distinct types and create a
I am tying to dupilicate a set of records changing only one field. That
field is part of a UNIQUE key. So far I copy the records into themselves
and keep the same number of records:
insert ignore into user_projects select * from user_projects where
user_id=[EMAIL PROTECTED] and
Hi,
I am hoping you meen this:
You have to use the fields in your into -statement and select statement,
not including the field having the auto-numbering
so if e.g. field1 has autonumbering -
insert into table1 (field2, field3) select (field2, field3) from table1;
autonumbering will
That is the effect that I am looking for, but exactly the method that I
am trying to avoid. If I type the column names into my INSERT... SELECT
and someone later adds a column to the table, I would have to go back
into my program and update the statement. I am looking for a way to do
the column names into my INSERT... SELECT
and someone later adds a column to the table, I would have to go back
into my program and update the statement. I am looking for a way to do
it dynamically in order to avoid maintenance of the statement in my
program later.
Rob
Danny Stolle [mailto:[EMAIL
Schimmel LCpl Robert B (GCE 2nd Intel Bn Web Master) wrote:
That is the effect that I am looking for, but exactly the method that
I
am trying to avoid. If I type the column names into my INSERT...
SELECT
and someone later adds a column to the table, I would have to go back
into my program
:
That is the effect that I am looking for, but exactly the method that
I
am trying to avoid. If I type the column names into my INSERT...
SELECT
and someone later adds a column to the table, I would have to go back
into my program and update the statement. I am looking for a way to do
it dynamically
:
That is the effect that I am looking for, but exactly the method that I
am trying to avoid. If I type the column names into my INSERT... SELECT
and someone later adds a column to the table, I would have to go back
into my program and update the statement. I am looking for a way to do it
dynamically in order
Subject: Re: insert into... select... duplicate key
Relevant bits of the conversation so far, with my thoughts at the end:
Schimmel LCpl Robert B (GCE 2nd Intel Bn Web Master) wrote:
Here is the problem that I am having. I am trying to make a copy of a
full record in a table that has a primary key
Here is the problem that I am having. I am trying to make a copy of a
full record in a table that has a primary key with auto-increment. The
real problem is that I want the statement to use SELECT * so that if
columns ever get added to the table the statement will still work for
the full record. I
Thanks for all the feedback. Here's my latest attempt:
SELECT @start:=NOW();
SELECT @date1:=DATE_SUB( CURDATE(), INTERVAL 1 MONTH);
SELECT @date2:=CURDATE();
LOCK TABLES rptPricingTEST READ, rptPricingTEST a READ;
CREATE TEMPORARY TABLE tmpLatestDates
SELECT
commodity,
:
Fax to:
05/27/2004 05:01 Subject: Re: slow insert into select
statement
AM
I have this insert statement that took a long time to execute:
INSERT INTO priceLast5
SELECT
DISTINCT a.commodity,
a.PricingDt
FROM rptPricingTEST a
WHERE
a.PricingDt = (
SELECT MAX(PricingDt)
FROM
If you do the math a large result set will be created. You could rewriting
your query or adding more indexes to see if this speeds up the process.
-Original Message-
From: nyem
To: [EMAIL PROTECTED]
Sent: 5/26/04 2:57 AM
Subject: slow insert into select statement
I have this insert
Hi,
I would start with finding out if it's the select or the insert that's
taking a long time...
Does the priceLast5 table have heavy indexes to build?
Try running the select seperately and see how long it takes...
Andrew
-Original Message-
From: Victor Pendleton [mailto:[EMAIL
only
once for the entire table and not once per row (per row, per row,...)
CREATE TEMPORARY TABLE tmpLatestDates
SELECT commodity, MAX(PricingDt) as MaxDate
FROM rptPricingTEST
WHERE PricingDt @date1
AND PricingDt = @date2
GROUP BY commodity
INSERT INTO priceLast5
SELECT DISTINCT a.commodity
int
data_colocacaodate
cod_componenteint (FK references another
table)
I get an erro saying that i cannot use that table in the select, the table
is a InnoDB.
Can i use the same table in the insert
date
cod_componenteint (FK references another
table)
I get an erro saying that i cannot use that table in the select, the table
is a InnoDB.
Can i use the same table in the insert into select? do i have to use a
temporary table?
If anybody have
Table ProductSums has not been created. Can you create this table when
you insert data into it?
INSERT INTO ProductSums
SELECT DISTINCTROW IndenturedList.NSIPartNumber,
Sum(tblInvTransaction.Qty) AS SumOfQty
FROM IndenturedList;
OK, I found the answer.
CREATE TABLE ProductSums
SELECT DISTINCTROW IndenturedList.NSIPartNumber,
Sum(tblInvTransaction.Qty) AS SumOfQty
FROM IndenturedList;
Is there a limit on the number of rows that can be
inserted in this way? Ie, at what point should I start
worrying about out of memory errors or something
similar?
So, how many rows can/should be returned by the SELECT clause?
__
Do you Yahoo!?
Yahoo! SiteBuilder
Hello Riaan,
RO Is there a limit on the number of rows that can be
RO inserted in this way? Ie, at what point should I start
RO worrying about out of memory errors or something
RO similar?
RO So, how many rows can/should be returned by the SELECT clause?
I had a similar case.
Difference is that
Riaan Oberholzer [EMAIL PROTECTED] wrote:
Is there a limit on the number of rows that can be
inserted in this way? Ie, at what point should I start
worrying about out of memory errors or something
similar?
So, how many rows can/should be returned by the SELECT clause?
There is no
PROTECTED]
Subject: INSERT INTO () SELECT...
Hi,
This should work, I think, but doesn't
INSERT INTO holds (ord_num)
SELECT orders.ord_num FROM orders
LEFT JOIN holds ON orders.ord_num = holds.ord_num
WHERE holds.ord_num IS NULL
I have some order numbers that are not in holds that are in orders. I
Hi Eric,
thats oracle function INSERT INTO ... SELECT. it doesn't work in
mysql.
Mirza
[EMAIL PROTECTED]
__
21.11.2002 22:13
Hi,
This should work, I think, but doesn't
INSERT INTO holds (ord_num)
SELECT orders.ord_num FROM orders
Hi,
Yes it works, but you can't insert and select data from the same table with
this syntax.
Regards,
Jocelyn
- Original Message -
From: Mirza Muharemagic [EMAIL PROTECTED]
To: Eric [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, November 22, 2002 12:30 AM
Subject: Re: INSERT
Hello,
I recently stumbled upon the INSERT INTO..SELECT abilities. Basically
what I'm doing is archiving records into another table before deleting
them (inventory information). However, I'd like to have the archive
table to have one more field than the original table: a date_archived
function
stumbled upon the INSERT INTO..SELECT abilities. Basically
what I'm doing is archiving records into another table before deleting
them (inventory information). However, I'd like to have the archive
table to have one more field than the original table: a date_archived
function. So, for example
Assessment
University of Washington
- Original Message -
From: Greg Macek [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 8:06 AM
Subject: INSERT INTO ... SELECT question
Hello,
I recently stumbled upon the INSERT INTO..SELECT abilities. Basically
what I'm
, Office of Educational Assessment
University of Washington
- Original Message -
From: Greg Macek [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 8:06 AM
Subject: INSERT INTO ... SELECT question
Hello,
I recently stumbled upon the INSERT
At 11:15 -0600 11/14/02, Greg Macek wrote:
Thanks for the tip! Looks like I can change my date_archived field to
timestamp(8), since all I care about for this is the date information
(actual time is useless to me). My sql query all of a sudden got a lot
simpler. Thanks again for the help!
are not up to date after the insert into ... select query
?
Thanks for you enlightenment :)
Kinds regards,
Alex.
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com
insert ignore into select from
will skip duplicates.
Karl J. Stubsjoen wrote:
Hello,
How can I determin what erros occur from an Insert into select from
statement? Namely, I'm looking for any duplicate record errors. It is
important to inform the user (in a web browser) whether
Hello,
How can I determin what erros occur from an Insert into select from
statement? Namely, I'm looking for any duplicate record errors. It is
important to inform the user (in a web browser) whether or not a particular
insert would fail.
Must I perform a lookup first, or is there a way
-Ursprüngliche Nachricht-
Von: Ferdinand, Dieter
Gesendet am: Donnerstag, 22. August 2002 10:56
An: '[EMAIL PROTECTED]'
Betreff: problem with null values by insert into .. select ..from ..
join
hello,
i have one problem with insert into ... select ... from .. join
This was resolved by adding an auto-increment column.
MySQL does not seem capable of coping with the situation below.
- Original Message -
From: Dave [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 30, 2002 5:36 PM
Subject: INSERT INTO . SELECT
I am having problems
What analysis are you performing which causes you to conclude that nothing
is being delayed? I'd probably check this by creating an insert...select
which takes at least a few seconds to execute, and then have my test
application log the time, make the call to MySQL, and log the time again. I
I am having problems with this INSERT INTO, below is a example. The SQL is
built in an ASP page and ASPVariable is, well the variable in the ASP page.
For some reason this will only insert the first row. In my test data the
SELECT alone returns 3 rows, but when added to the INSERT INTO only
Hello,
I'm trying to use the DELAYED keyword with an INSERT ... SELECT
statement but it seems to ignore the DELAYED. Does anyone know if this
is or is not supposed to work? Exmple:
session 1 session 2
hi,
i have 2 tables:
currencyrates
+-+++
| code char(3)|| currency char(3) |
| name varchar(10)|| rate double|
| bcurrency char(1) |
condition in the where clause.
2)
i have a read only table! error message when i try to execute a insert
into ...select
from a program.
How can i check this status of the table??
Is there a command to tell me which table is read only at a particular time
I think that I saw a similar query last week some time but I cannot
remember the sql syntax. Is it possible to insert from a select.
Something like
insert into table_a from select * from table_b where blah=somevalue
Thanks,
David McInnis
- Original Message -
From: David McInnis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, March 16, 2002 3:26 PM
Subject: Insert from select
I think that I saw a similar query last week some time but I cannot
remember the sql syntax. Is it possible to insert from a select
On Saturday, 16. March 2002 09:26, David McInnis wrote:
I think that I saw a similar query last week some time but I cannot
remember the sql syntax. Is it possible to insert from a select.
See http://www.mysql.com/doc/I/N/INSERT_SELECT.html
Regards Georg
Hi:
how i can insert and select information at the same time.
first i want to insert the information relative to the client and after
that i need to select the same information on the same query.
that is possible
_
Do You Yahoo
Hi
No you can't.
if you are using and AUTO_INCREMENT field as a key you could follow the
INSERT with a select statement like:
SELECT * FROM tablename WHERE keyfield = LAST_INSERT_ID()
See the manual: LAST_INSERT_ID()
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
Hello,
I'm relatively new to mysql and I've come
across a problem while trying to insert
values from
multiple tables into a single, existing
table. Here's the syntax that I'm using:
insert into table1 (col1,col2,col3,col4)
select Foo.col1, Foo.col2, Bar.col3,
Bunk.col4 from table2 as
Foo,
Hello,
I'm relatively new to mysql and I've come
across a problem while trying to insert
values from
multiple tables into a single, existing
table. Here's the syntax that I'm using:
insert into table1 (col1,col2,col3,col4)
select Foo.col1, Foo.col2, Bar.col3,
Bunk.col4 from table2 as
Foo,
Thanks for the response,
but doing this results in :
ERROR 1093: INSERT TABLE 'myTable' isn't allowed in FROM table list
marc
-Ursprüngliche Nachricht-
Von: Nathan [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 14. November 2001 19:05
An: Votteler Marc
Betreff: Re: INSERT with SELECT
-Ursprüngliche Nachricht-
Von: Rick Emery [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 14. November 2001 19:46
An: Votteler Marc; [EMAIL PROTECTED]
Betreff: RE: INSERT with SELECT on same table
If one of the table's fields is defined as UNIQUE or PRIMARY KEY, it will
allow the insertion
insert-select on the same table is not allowed in MySQL. If I remember
right it isn't allowed in ANSI SQL either, supposedly because it could lead
to infinite loops if implemented poorly.
Jon Gardiner.
-Original Message-
From: Votteler Marc [mailto:[EMAIL PROTECTED]]
Sent: Thursday
insert-select on the same table is not allowed in MySQL. If I remember
right it isn't allowed in ANSI SQL either, supposedly because it
could lead
to infinite loops if implemented poorly.
Jon Gardiner.
Core SQL support does not require the DBMS to support it; enhanced
SQL support allows
Hi there,
I am currently facing the following problem and hope someone can help me.
I want to make an INSERT into a Table only if I haven't done this before.
This is because the INSERT can be done by several Programs and the record
should only be inserted once.
I have found the following
?
-Original Message-
From: Votteler Marc [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 11:01 AM
To: [EMAIL PROTECTED]
Subject: INSERT with SELECT on same table
Hi there,
I am currently facing the following problem and hope someone can help me.
I want to make an INSERT
At 12:53 PM +0800 10/3/01, chong wee siong wrote:
Hi DBAs:
I want to copy TableA in DatabaseA to TableB in DatabaseB
with changes in the attributes of the tables, what options do I have?
I tried these:
a) insert into TableB (id) select (id) from DatabaseA.TableA;
this works
b) insert into
Hi DBAs:
I want to copy TableA in DatabaseA to TableB in DatabaseB
with changes in the attributes of the tables, what options do I have?
I tried these:
a) insert into TableB (id) select (id) from DatabaseA.TableA;
this works
b) insert into TableB (id,data) select (id,data) from
Hello,
This is the situation:
Table1:
ID Startnr TijdAfstand SlagDatum Opmerking CRvan CRtot PR
Categorie
Table2:
Identical columns.
What is the problem? I'm trying to append all the values from table2 to
table1.
I was trying this SQL query:
insert into table1
-
From: Michiel Leegwater [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 3:25 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Problem with INSERT INTO ... SELECT
Hello,
This is the situation:
Table1:
ID Startnr TijdAfstand SlagDatum Opmerking CRvan CRtot PR
On Mon, 20 Aug 2001, Michiel Leegwater wrote:
insert into table1 select Startnr, Tijd, Afstand, Slag, Datum, Opmerking,
CRvan,CRtot,PR,Categorie from table2;
This doesn't work, it says Column count doesn't match value count at row 1
I understand the problem. But I can't use my ID column
hi all.
i have a problem. i use mysql-3.23.32 on FreeBSD4.2-release
my project need to update/insert some datas into mysql every 5mins.
but sometims these datas are lots. so i need to reduce the update/insert time as
short as possible, prevent it run over 5mins.
i found out that if i use
81 matches
Mail list logo