Re: Insert problem

2003-07-01 Thread Jake Johnson
Have you tried single quotes (ie. registry_program='EA')?

Regards,
Jake Johnson
[EMAIL PROTECTED]

--
Plutoid - http://www.plutoid.com - Shop Plutoid for the best prices on
Rims, Car Audio, and Performance Parts.


On Mon, 30 Jun 2003, Sparky Kopetzky wrote:

 Greetings!!

 I'm trying this insert and it will not run in batch mode. I think the '' syntax 
 is right but what else am I missing??

 insert into registry set registry_program=EA, registry_key=BASE_PATH, 
 registry_value=f:auction;

 Robin E. Kopetzky
 Black Mesa Computers/Internet Services
 www.blackmesa-isp.net



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Insert problem

2003-06-30 Thread Sparky Kopetzky
Greetings!!

I'm trying this insert and it will not run in batch mode. I think the '' syntax is 
right but what else am I missing??

insert into registry set registry_program=EA, registry_key=BASE_PATH, 
registry_value=f:auction;

Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net



Re: BLOB insert problem used ' '

2002-07-09 Thread Mark Worsdall

Hi all,

Sorry should have got my mind around the  LOAD_FILE('./image.tiff') 
method.

M.

In message [EMAIL PROTECTED], Mark Worsdall 
[EMAIL PROTECTED] writes
Hi,

After a good old slurp of an image I am trying to stick it into my
table.


# Slurp file
foreach (@image_list) {
  my $image = /usr/home/shadow/Vision/$_;

  # Load image into memory
  my $imagePIC = do
  {
  local ($/, *PIC); # slurp mode, local file handle
  open PIC, $image or die can't open '$image': $!;
  binmode PIC;
  PIC
  };


And this is how I am sticking it in, but I get an error reported in my
sql code.

my $prep = INSERT INTO object (object) VALUES ('$image');

see anything wrong?

I tried:
my $prep = INSERT INTO object (count) VALUES (1);

to check I can insert, and I can.

M.


-- 
Work:- postmasterAThinwick.demon.co.uk

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




BLOB insert problem used ' '

2002-07-06 Thread Mark Worsdall

Hi,

After a good old slurp of an image I am trying to stick it into my
table.


# Slurp file
foreach (@image_list) {
  my $image = /usr/home/shadow/Vision/$_;

  # Load image into memory
  my $imagePIC = do
  {
  local ($/, *PIC); # slurp mode, local file handle
  open PIC, $image or die can't open '$image': $!;
  binmode PIC;
  PIC
  };


And this is how I am sticking it in, but I get an error reported in my
sql code.

my $prep = INSERT INTO object (object) VALUES ('$image');

see anything wrong?

I tried:
my $prep = INSERT INTO object (count) VALUES (1);

to check I can insert, and I can.

M.

-- 
Work:- postmasterAThinwick.demon.co.uk

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




insert problem

2002-04-29 Thread saraswathy saras



hi everybody,

I have problem with inserting data into table.
MY table is:-
Name  type
IDint(9)autoincrement
Total int(9)

while i insert the data,i want the total(ID+2).Its mean the record should be 
like this:-

ID Total
1   3
2   4
3   5

is it possiblei have try is like this
mysqlinsert into TableName(total) values(ID+2);

The result is like this:-
ID Total
1   2
2   2
3   2

its cannot worksis there any ideas..please help me

sql,query

thanks in advance.



_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: insert problem

2002-04-29 Thread Benjamin Pflugmann

Hi.

On Mon, Apr 29, 2002 at 10:00:07AM +, [EMAIL PROTECTED] wrote:
 
 hi everybody,
 
 I have problem with inserting data into table.
 MY table is:-
 Name  type
 IDint(9)autoincrement
 Total int(9)
 
 while i insert the data,i want the total(ID+2).Its mean the record should 
 be like this:-
 
 ID Total
 1   3
 2   4
 3   5
 
 is it possiblei have try is like this
 mysqlinsert into TableName(total) values(ID+2);

You cannot reference columns from within an INSERT clause.

You could do it in two steps:

INSERT INTO TableName (total) VALUES (2);
UPDATE TableName SET total=total+LAST_INSERT_ID() WHERE ID=LAST_INSERT_ID();

or

SELECT @next = MAX(ID)+1 FROM TableName;
INSERT INTO TableName (total) VALUES (@next+2);

 The result is like this:-
 ID Total
 1   2
 2   2
 3   2
 
 its cannot worksis there any ideas..please help me

Well, if you need always need this, your table design is IMHO flawed.
The total column would be redundant, because you could always select
(ID+2).

Bye,

Benjamin.


-- 
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT Problem with mm.mysql, JBoss and an EJB

2001-09-24 Thread Michael Tam

Hi Robert,

I have experience the similar issue with MySQL, MM.MySQL and JBOSS.

I was using CMP-EJBs with INNODB table from MySQL-Max and data did not
persist in the table as I called EJB create().  The issue resolved as I
'alt' the table back to MyISAM tables.

I have posted the issue in couple of newsgroups but didn't get a reply
on resolving it nor pin-pointing the cause of it.

Regards,
Michael

- Original Message -
From: Robert Grey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 24, 2001 11:35 AM
Subject: INSERT Problem with mm.mysql, JBoss and an EJB


 I am currently working on a project employing EJBS contained by JBoss with
a
 MySQL-Max database. Any attempt to insert a record into a project table
 yields no entries (project is of type BDB) but when project is changed
to
 type MyISAM the entries work. In this particular project, we call multiple
 EJB creates at the same time which is the only difference we can see
between
 the other working EJBs. Here is the schema for table project:

 CREATE TABLE project (
   PROJECT_ID int(10) unsigned zerofill NOT NULL auto_increment,
   PROJECT_NAME varchar(25) NOT NULL default '',
   START_DATE timestamp(14) NOT NULL,
   PROJECT_STATUS enum('OPEN','CLOSED') NOT NULL default 'OPEN',
   LOCK_STATUS enum('Y','N') NOT NULL default 'Y',
   GC_APPROVER enum('OWNER','ARCHITECT') NOT NULL default 'OWNER',
   END_DATE timestamp(14) NOT NULL,
   PRIMARY KEY  (PROJECT_ID)
 ) TYPE=BerkeleyDB;

 and here is the EJB code that inserts the record:

 String qry = INSERT INTO PROJECT VALUES (NULL, ?, ?, ?, ?, ?, ?);

 PreparedStatement prepStmt = null;
 Statement stmt = null;
 ResultSet rs = null;
 try {

 prepStmt = getDBConnection().prepareStatement (qry);
 int i = 1;
 prepStmt.setString(i++, projectDetail.getProjectName());
 prepStmt.setDate(i++, projectDetail.getStartDate());
 prepStmt.setString(i++, projectDetail.getStatus());
 prepStmt.setString(i++, projectDetail.isLocked() ? Y : N);
 prepStmt.setString(i++, projectDetail.getGC_Approver());
 prepStmt.setDate(i++, new java.sql.Date(0));
 prepStmt.executeUpdate();
 prepStmt.close();
 closeConnection();

 stmt = getDBConnection().createStatement();
 stmt.executeQuery (SELECT LAST_INSERT_ID() AS ID);
 rs = stmt.getResultSet();
 rs.first();
 projectId = rs.getInt (ID);

 }

 The process of creating the prepared statement works and we can see the
 correct results before the system attempts an insert. When we change the
 query to a regular statement (instead of a prepared statement) JBoss hangs
 and won't budge. When we change the query to INSERT INTO PROJECT
 (PROJECT_NAME) VALUES ('TEST') we get the same results. Any suggestions
 would be appreciated.

 -Robert Grey
 [EMAIL PROTECTED]

 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


 -
 Please check http://www.mysql.com/Manual_chapter/manual_toc.html; before
 posting. To request this thread, e-mail [EMAIL PROTECTED]

 To unsubscribe, send a message to the address shown in the
 List-Unsubscribe header of this message. If you cannot see it,
 e-mail [EMAIL PROTECTED] instead.



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT problem

2001-08-15 Thread btjones


Try it like this --

 SELECT @BF:=Date FROM Results WHERE GameID=1 ORDER BY Date ASC LIMIT
1;
 SELECT @BL:=Date FROM Results WHERE GameID=1 ORDER BY Date DESC LIMIT
1;
 SELECT @BF AS BF, @BL AS BL;



Mariusz Muszalski [EMAIL PROTECTED] wrote:

Look at this MS SQL:

Declare @BF char(10)
Declare @BL char(10)

SET ROWCOUNT 1
Select @BF=Date From Results Where GameID=1 Order by Date ASC
Select @BL=Date From Results Where GameID=1 Order by Date DESC

Select @BF As BF, @BL As BL





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERT problem

2001-08-14 Thread Mariusz Muszalski

Look at this MS SQL:

Declare @BF char(10)
Declare @BL char(10)

SET ROWCOUNT 1
Select @BF=Date From Results Where GameID=1 Order by Date ASC
Select @BL=Date From Results Where GameID=1 Order by Date DESC

Select @BF As BF, @BL As BL

--

Now wonna to implement above to mySQL:
I used temprary table (is there any other way?)

CREATE TEMPORARY TABLE tmp(BF char(10) not null, BL char(10) not null);

INSERT INTO tmp (BF) SELECT Date From Results Where GameID=1 Order by Date
ASC LIMIT 1;
INSERT INTO tmp (BL) SELECT Date From Results Where GameID=1 Order by Date
DESC LIMIT 1;

SELECT * from tmp;
DROP TABLE tmp;

--

problem is INSERT INTO creates a new record every time...I tried to use
UPDATE in instead the second INSERT:

UPDATE tmp SET BL = (SELECT Date From Results Where GameID=1 Order by Date
DESC LIMIT 1);

But there is error in the syntax

Questions: is there only TEMPORARY TABLE way for make it? What is wrong with
this UPDATE?

Cheers,
Mariusz Muszalski


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: INSERT problem

2001-08-14 Thread Yosi Oren

Hi,
You are trying to use nested select for that update wich MySQL do not
support insted use :
update table set field = value from table inner join table where bla = bla


Sincerely,

Yosi Oren
VP,RD manager
Tel : +972 4 908 2180 ext 217
Fax : +972 4 908 2181
Mobile  : +972 54 533190
E-mail:  [EMAIL PROTECTED] 
Web  :  www.spiralsolutions.com 




-Original Message-
From: Mariusz Muszalski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 12:44 PM
To: [EMAIL PROTECTED]
Subject: INSERT problem


Look at this MS SQL:

Declare @BF char(10)
Declare @BL char(10)

SET ROWCOUNT 1
Select @BF=Date From Results Where GameID=1 Order by Date ASC
Select @BL=Date From Results Where GameID=1 Order by Date DESC

Select @BF As BF, @BL As BL

--

Now wonna to implement above to mySQL:
I used temprary table (is there any other way?)

CREATE TEMPORARY TABLE tmp(BF char(10) not null, BL char(10) not null);

INSERT INTO tmp (BF) SELECT Date From Results Where GameID=1 Order by Date
ASC LIMIT 1;
INSERT INTO tmp (BL) SELECT Date From Results Where GameID=1 Order by Date
DESC LIMIT 1;

SELECT * from tmp;
DROP TABLE tmp;

--

problem is INSERT INTO creates a new record every time...I tried to use
UPDATE in instead the second INSERT:

UPDATE tmp SET BL = (SELECT Date From Results Where GameID=1 Order by Date
DESC LIMIT 1);

But there is error in the syntax

Questions: is there only TEMPORARY TABLE way for make it? What is wrong with
this UPDATE?

Cheers,
Mariusz Muszalski


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT problem

2001-08-14 Thread Gerald Clark

MySQL does not support multi table updates yet either.

Yosi Oren wrote:

 Hi,
 You are trying to use nested select for that update wich MySQL do not
 support insted use :
 update table set field = value from table inner join table where bla = bla
 .
 
 Sincerely,
 
 Yosi Oren
 VP,RD manager
 Tel : +972 4 908 2180 ext 217
 Fax : +972 4 908 2181
 Mobile  : +972 54 533190
 E-mail:  [EMAIL PROTECTED] 
 Web  :  www.spiralsolutions.com 
 
 
 
 
 -Original Message-
 From: Mariusz Muszalski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 14, 2001 12:44 PM
 To: [EMAIL PROTECTED]
 Subject: INSERT problem
 
 
 Look at this MS SQL:
 
 Declare @BF char(10)
 Declare @BL char(10)
 
 SET ROWCOUNT 1
 Select @BF=Date From Results Where GameID=1 Order by Date ASC
 Select @BL=Date From Results Where GameID=1 Order by Date DESC
 
 Select @BF As BF, @BL As BL
 
 --
 
 Now wonna to implement above to mySQL:
 I used temprary table (is there any other way?)
 
 CREATE TEMPORARY TABLE tmp(BF char(10) not null, BL char(10) not null);
 
 INSERT INTO tmp (BF) SELECT Date From Results Where GameID=1 Order by Date
 ASC LIMIT 1;
 INSERT INTO tmp (BL) SELECT Date From Results Where GameID=1 Order by Date
 DESC LIMIT 1;
 
 SELECT * from tmp;
 DROP TABLE tmp;
 
 --
 
 problem is INSERT INTO creates a new record every time...I tried to use
 UPDATE in instead the second INSERT:
 
 UPDATE tmp SET BL = (SELECT Date From Results Where GameID=1 Order by Date
 DESC LIMIT 1);
 
 But there is error in the syntax
 
 Questions: is there only TEMPORARY TABLE way for make it? What is wrong with
 this UPDATE?
 
 Cheers,
 Mariusz Muszalski
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT problem

2001-08-14 Thread Grigory Bakunov

Date |Tue, 14 Aug 2001 10:43:36 +0100
From |Mariusz Muszalski [EMAIL PROTECTED]

Hello!

MM Look at this MS SQL:

MM Declare @BF char(10)
MM Declare @BL char(10)

MM SET ROWCOUNT 1
MM Select @BF=Date From Results Where GameID=1 Order by Date ASC
MM Select @BL=Date From Results Where GameID=1 Order by Date DESC

MM Select @BF As BF, @BL As BL

MM --

MM Now wonna to implement above to mySQL:
MM I used temprary table (is there any other way?)

MM CREATE TEMPORARY TABLE tmp(BF char(10) not null, BL char(10) not null);

MM INSERT INTO tmp (BF) SELECT Date From Results Where GameID=1 Order by Date
MM ASC LIMIT 1;
MM INSERT INTO tmp (BL) SELECT Date From Results Where GameID=1 Order by Date
MM DESC LIMIT 1;

MM SELECT * from tmp;
MM DROP TABLE tmp;

MM --

MM problem is INSERT INTO creates a new record every time...I tried to use
MM UPDATE in instead the second INSERT:

MM UPDATE tmp SET BL = (SELECT Date From Results Where GameID=1 Order by Date
MM DESC LIMIT 1);

MM But there is error in the syntax

MM Questions: is there only TEMPORARY TABLE way for make it? What is wrong with
MM this UPDATE?

MM Cheers,
MM Mariusz Muszalski

As far as i know UPDATE command can't be used with nested SELECT.
you need to add one operation to your query.

CREATE TEMPORARY TABLE tmp(BF char(10) not null, BL char(10) not null);


DELETE FROM tmp;
INSERT INTO tmp (BF) SELECT Date From Results Where GameID=1 Order by Date ASC LIMIT 1;
INSERT INTO tmp (BL) SELECT Date From Results Where GameID=1 Order by Date DESC LIMIT 
1;

...
SELECT * from tmp;
DROP TABLE tmp;


___
For technical support contracts, visit https://order.mysql.com/
This email is sponsored by SWSoft, http://www.asplinux.ru/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Grigory Bakunov [EMAIL PROTECTED]
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB / SWSoft
/_/  /_/\_, /___/\___\_\___/
   ___/   www.mysql.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT problem

2001-07-13 Thread Joe Taraba

Glyndower;

I just joined the PHP mailing list. It appears to be fairly active and 
knowledgable. Your question seems to be MORE PHP related than MySQL.

I know, I hate joining half a dozen lists to get answers, and the MySQL 
list has been most helpful with database questions, but this sounds like 
something for the PHP guys.

I can't answer your question--I'm a green weenie newbie, but I would like 
to see how the PHP list answers it. So join that list and fire off the 
question.

I look forward to seeing their reply.

Joe

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

At 06:31 AM 07/03/2001 , you wrote:
Hi all,

I'm new to the whole PHP and MySql stuff and I hopeful that I can get a push
in the right direction for what I'm sure is a very sinple problem.

I have succesfully created a databse using telnet and added data to it also
using telnet.

I have also succesfully got the data to display on a page using PHP.

My problem is adding data from the PHP page.

My insert code is:

$query = INSERT INTO guests ;

$query .= (guest_id, guest_name, ;

$query .= guest_email, guest_time, guest_message) ;

$query .= values(,'$name','$email',NULL,'$message');

mysql_pconnect(localhost,blahblah,blahblah)

or die(Unable to connect to SQL server);

mysql_select_db(blah) or die(Unable to select database);

mysql_query($query) or die(Insert Failed!);

When I add data via the form, npthing seems to happen, it does not add the
data to the databse, nor does it pop any errors.



Any help would be appreciated...tia


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERT problem

2001-07-03 Thread Glyndower

Hi all,

I'm new to the whole PHP and MySql stuff and I hopeful that I can get a push
in the right direction for what I'm sure is a very sinple problem.

I have succesfully created a databse using telnet and added data to it also
using telnet.

I have also succesfully got the data to display on a page using PHP.

My problem is adding data from the PHP page.

My insert code is:

$query = INSERT INTO guests ;

$query .= (guest_id, guest_name, ;

$query .= guest_email, guest_time, guest_message) ;

$query .= values(,'$name','$email',NULL,'$message');

mysql_pconnect(localhost,blahblah,blahblah)

or die(Unable to connect to SQL server);

mysql_select_db(blah) or die(Unable to select database);

mysql_query($query) or die(Insert Failed!);

When I add data via the form, npthing seems to happen, it does not add the
data to the databse, nor does it pop any errors.



Any help would be appreciated...tia




Re: INSERT problem

2001-07-03 Thread Werner Stuerenburg


 I have succesfully created a databse using telnet and added data to it also
 using telnet.

Why not do it with myPhpAdmin? Google shows you the address. Very
convienient. It pays at least in the long run - you won't bother
with telnet to maintain your db.

 I have also succesfully got the data to display on a page using PHP.

Good.

 My problem is adding data from the PHP page.

 When I add data via the form, npthing seems to happen, it does not add the
 data to the databse, nor does it pop any errors.

I didn't bother to understand your code and look for an error
source. You could look for an error message of mysql.

Ypur code ahows that the query has been issued successfully,
hence no death. But the result of the query was not what you
expected, hence there must be an error.

Here is how I do it. Again, very convenient. You put out ten
times as many queries this way. Not only that you are much more
productive, it is much more fun this way, too.

Use db_mysql.inc from PHPLIB (again: Google shows where to get
it). Then write:

include_once db_mysql.inc;
//include library
$datum = date(Y-m-d);
//get date
$db = new DB_Sql;
//let the lib connect etc.
$q = INSERT INTO 
(guest_name, guest_email, guest_time, guest_message)
VALUES ('$name','$email','$datum','$message');
//do it all in once - so you see what you do.
//don't provide for id's - use an autoincrement field instead and
//let mysql provide for numbering.
//if you have a date field, provide for a date value. It is easy.
//if you have NULL values, omit them.
$db-query($q);
//let the lib do the stuff
if ($db-Error) echo $db-Error . '\nbr';
//lib knows Error and shows it

I use an editor with shortcuts. I have shortcuts for all this
stuff, so I don't have to push the keys too often (RSI).

You could automate this further. Include the above error
statement into the query function in the library. If you work on
production systems, qualify this error message by the existence
of a cookie value which shows that you are testing. Hence other
users won't see anything, but you do automatically.

You can use the lib out of the box. Just provide for the
connection data, password etc. Make sure you put the location of
the lib outside your home dir or protect it with an .htaccess
file, as the password is in plain text in the local.inc file.


-- 
Herzlich
Werner Stuerenburg

_
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409
http://pferdezeitung.de


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT problem

2001-07-03 Thread David Robley

On Tue,  3 Jul 2001 23:01, Glyndower wrote:
 Hi all,

 I'm new to the whole PHP and MySql stuff and I hopeful that I can get a
 push in the right direction for what I'm sure is a very sinple problem.

 I have succesfully created a databse using telnet and added data to it
 also using telnet.

 I have also succesfully got the data to display on a page using PHP.

 My problem is adding data from the PHP page.

 My insert code is:

 $query = INSERT INTO guests ;

 $query .= (guest_id, guest_name, ;

 $query .= guest_email, guest_time, guest_message) ;

 $query .= values(,'$name','$email',NULL,'$message');

 mysql_pconnect(localhost,blahblah,blahblah)

 or die(Unable to connect to SQL server);

 mysql_select_db(blah) or die(Unable to select database);

 mysql_query($query) or die(Insert Failed!);

Add here

if(mysql_errno) { echo 'Error: ' . mysql_error() . 'BR'; }

and if there is an error returned by mysql it will be displayed.


 When I add data via the form, npthing seems to happen, it does not add
 the data to the databse, nor does it pop any errors.



 Any help would be appreciated...tia

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Now I can chop down that tree, said Tom with a heavy accent.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERT PROBLEM

2001-04-25 Thread Webmaster

Hello all
 I am running linux mandrake with Mysql vers 3.23.23-beta, for
pc-linux-gnu on i686

I've had a problem with recieving to many connections which i am working
on but my MAIN problem currently is that it will not allow me to insert
into tables.
I cleared out all the connections and can query the database and recieve
the answers.. but when i do a standard insert into one of the tables it
just seems to hang there.. its like it catches a lock or something. This
is an old table and these are the same query's its been using for over a
year.. other then fixing the table with myisamchk nothing has changed.
The table needed to be fixed due to the too many connections error which
currupted it appearantly.

Any idea's why it would be hanging on an insert statement?


Ter

--
Join the growing community of AngelHaven.com. 
Sign up for your free AngelHaven E-mail Today...
Visit us at http://www.AngelHaven.com 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Insert Problem in C API

2001-04-12 Thread Shambhu Kumar singh

Hi,

I am running a query using C APIs to insert a large text item into a MySQL table. 
The query is as follows

sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
  mydata);
where mydata is a C variable containing a large text item

The problem occurs when mydata contains a single quote, then that single quote is 
taken as the end of the column value by the MySQL parser and the data after the quote 
is ignored resulting in an error.

Help is urgently required.

Thanks in advance.

Shambhu kumar Singh.

_
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem in C API

2001-04-12 Thread Aigars Grins

 sprintf(szQuery,"Insert into mytable(mycol)values '%s' ",
   mydata);
 where mydata is a C variable containing a large text item

 The problem occurs when mydata contains a single quote, then that single
quote is taken as the end of the column value by the MySQL parser and the
data after the quote is ignored resulting in an error.

use:

/* unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const
char *from, unsigned int length) */
mysql_real_escape_string(ms, szQuery, mydata, strlen(mydata));

then:

sprintf(szQuery, "INSERT INTO mytable(mycol) VALUES '%s'", szQuery);

as stated from:

http://www.mysql.com/doc/m/y/mysql_real_escape_string.html

--
Aigars




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem

2001-01-30 Thread Rus

You can't use 'where' in 'insert' query. Use 'update' or 'replace'.



- Original Message -
From: Toby Miller [EMAIL PROTECTED]
To: Liste mysql [EMAIL PROTECTED]
Sent: Tuesday, January 30, 2001 2:28 PM
Subject: Insert Problem


I have a record being inserted and I don't see what the problem is. This is
the insert statement:

insert into auth_users (username, password, firstname, lastname, address1,
address2, city, state, zip, phone, fax, email, hint) values ("username",
"password", "firstname", "lastname", "Address1", "", "City", "ST", "12345",
"444-555-", "", "[EMAIL PROTECTED]", "password hint") where username =
"username" and password = "cd6c8f619fe02d9ea5d283cea1dfdefc"

Here is the error that I am getting:

You have an error in your SQL syntax near 'where username = "tobymiller" and
password = "cd6c8f619fe02d9ea5d283cea1dfdefc"' at line 1

I am using a MD5 encrypted string for the password, that's what that is.

Here is the table that this record is being inserted into:

CREATE TABLE auth_users (
   username varchar(20) NOT NULL,
   password varchar(120) NOT NULL,
   firstname varchar(36) NOT NULL,
   lastname varchar(36) NOT NULL,
   address1 varchar(60),
   address2 varchar(60),
   city varchar(60),
   state char(2),
   zip varchar(10),
   phone varchar(12),
   fax varchar(12),
   email varchar(120) NOT NULL,
   hint varchar(120),
   ipaddress varchar(15),
   hash varchar(120),
   created timestamp(14),
   createdby varchar(20) DEFAULT 'byhand' NOT NULL,
   loggedin timestamp(14),
   UNIQUE username (username)
);


Any ideas?

Thanks,
Toby




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert Problem

2001-01-30 Thread Toby Miller

My bad, not enough sleep I guess.

Thanks,
Toby

- Original Message -
From: "Roger Ramirez" [EMAIL PROTECTED]
To: "Toby Miller" [EMAIL PROTECTED]
Cc: "MySQL List" [EMAIL PROTECTED]
Sent: Tuesday, January 30, 2001 6:33 AM
Subject: Re: Insert Problem


 Hmmm I don't believe you can have a where in an insert statement.  You
 either do or you don't.  Perhaps you are thinking of update?

 - Original Message -
 From: "Toby Miller" [EMAIL PROTECTED]
 To: "Liste mysql" [EMAIL PROTECTED]
 Sent: Tuesday, January 30, 2001 6:28 AM
 Subject: Insert Problem


 I have a record being inserted and I don't see what the problem is. This
is
 the insert statement:

 insert into auth_users (username, password, firstname, lastname, address1,
 address2, city, state, zip, phone, fax, email, hint) values ("username",
 "password", "firstname", "lastname", "Address1", "", "City", "ST",
"12345",
 "444-555-", "", "[EMAIL PROTECTED]", "password hint") where username =
 "username" and password = "cd6c8f619fe02d9ea5d283cea1dfdefc"

 Here is the error that I am getting:

 You have an error in your SQL syntax near 'where username = "tobymiller"
and
 password = "cd6c8f619fe02d9ea5d283cea1dfdefc"' at line 1

 I am using a MD5 encrypted string for the password, that's what that is.

 Here is the table that this record is being inserted into:

 CREATE TABLE auth_users (
username varchar(20) NOT NULL,
password varchar(120) NOT NULL,
firstname varchar(36) NOT NULL,
lastname varchar(36) NOT NULL,
address1 varchar(60),
address2 varchar(60),
city varchar(60),
state char(2),
zip varchar(10),
phone varchar(12),
fax varchar(12),
email varchar(120) NOT NULL,
hint varchar(120),
ipaddress varchar(15),
hash varchar(120),
created timestamp(14),
createdby varchar(20) DEFAULT 'byhand' NOT NULL,
loggedin timestamp(14),
UNIQUE username (username)
 );


 Any ideas?

 Thanks,
 Toby




 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert problem in MYSQL with PHP

2001-01-28 Thread Adrian D'Costa

On Wed, 24 Jan 2001, Xinkun Wang wrote:
|
|I've got a problem about Mysql table. if I insert several records in a
|certain order, firstly it is ok, but when I delete them and insert those 
|records again (in the same sequence), But the order in MySql is totally 
|different.  For instance, I have 78 records, when I do insert
|secondly, it dispalys 58th record firstly and others in reverse order.
|Anybody know why? (I use PHP script)

Depends on what way you have set up your script.

-- 
=== 
Adrian D'Costa 
[EMAIL PROTECTED] 
www.pcsadvt.com
===


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Insert problem in MYSQL with PHP

2001-01-24 Thread Xinkun Wang

Hi

I've got a problem about Mysql table. if I insert several records in a
certain order, firstly it is ok, but when I delete them and insert those 
records again (in the same sequence), But the order in MySql is totally 
different.  For instance, I have 78 records, when I do insert
secondly, it dispalys 58th record firstly and others in reverse order.
Anybody know why? (I use PHP script)

Thank you in advance.

Xinkun WANG
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Insert problem in MYSQL with PHP

2001-01-24 Thread Carsten H. Pedersen

This has nothing to do with PHP, and you should
never expect a relational database to store records 
in a specific order.

If you need to order your data, you should create
a key field. Look up AUTO INCREMENT in the manual,
then, if you have trouble, read
http://www.bitbybit.dk/mysqlfaq/faq.html#ch6_0_0.

Use that column to sort your result (look up ORDER
BY in the manual)


/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq

 -Original Message-
 From: Xinkun Wang [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 24, 2001 12:10 PM
 To: [EMAIL PROTECTED]
 Subject: Insert problem in MYSQL with PHP
 
 
 Hi
 
 I've got a problem about Mysql table. if I insert several records in a
 certain order, firstly it is ok, but when I delete them and insert those 
 records again (in the same sequence), But the order in MySql is totally 
 different.  For instance, I have 78 records, when I do insert
 secondly, it dispalys 58th record firstly and others in reverse order.
 Anybody know why? (I use PHP script)
 
 Thank you in advance.
 
 Xinkun WANG
 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php