Re: last_insert_id gives 0

2002-04-08 Thread Kevin Donnelly

Hi Paul

On Monday 08 April 2002 12:56 am, Paul DuBois wrote:
 You're inserting a specific value into the AUTO_INCREMENT field, which
 doesn't result in the creation of a new automatic sequence number.

 If you want to insert a record with a specific value in that column, *and*
 you want the value to be treated like an AUTO_INCREMENT value, so that
 LAST_INSERT_ID() will return that value, then do this:
 INSERT INTO customers (customer_id VALUES(LAST_INSERT_ID(10));

Thank you very much indeed for this succinct explanation (and the 
workaround).  This makes sense now, so another small corner of MySQL has been 
illuminated for me!  Thanks again.

Kevin


-
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




last_insert_id gives 0

2002-04-07 Thread Kevin Donnelly

I am running MySQL 3.23.41-17 on a stock SuSE 7.3 install.  I have a table 
customers with an auto-incrementing primary key customer_id.  If I insert 
a record:
mysql insert into customers(customer_id) values (10);
and then ask for the last insert:
mysql select last_insert_id();
(which I thought was the correct syntax) I get the response 0.

If I ask:
mysql select last_insert_id() from customers;
I get as many zeros as there are records.

If I ask:
mysql select last_insert_id(customer_id) from customers;
I get the ids for all the records.

If I then ask:
mysql select last_insert_id();
I get the last record inserted (which was what was supposed to happen, I 
thought), BUT if I insert another record and repeat:
mysql select last_insert_id();
I get the same number as the last time I asked - ie the last but one.

However, if I then ask:
mysql select last_insert_id(customer_id) from customers;
followed by: 
mysql select last_insert_id();
I get the most recently-added record number.

Could some kind person on the list please explain what is happening here, and 
why the standard syntax does not give the results I expect?

Thank you.

Kevin



-
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: Locked out

2001-12-17 Thread Kevin Donnelly

On Monday 17 December 2001 15:04, David VanHorn wrote:
 I killed all Mysql processes, and confirmed that they are killed (ps -ef |
 grep mysql)
 Then I restart with  safe_mysqld --skip-grant-tables
 Trying to log in to mysql in any way, including mysql -h localhost mysql
 or mysql root  or mysql root -p gives me the failed password error again.

The only time I ever did this, I did the following:

- safe_mysqld --skip-grant-tables

- mysql -u root mysql

- update user set password=password(mypass) where user=root;

- exit

- mysqladmin -u root reload

- mysql -uroot -p

- enter mypass

That allowed me back in with the correct password.

You don't seem to be including the -u marker in the options you have tried 
above.

Kevin

-
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




MyODBC availability

2001-12-17 Thread Kevin Donnelly

Does anyone know why it is that the MyODBC authors prefer not to allow that 
to be distributed in the unixODBC package, or with distros (eg the SuSE CDs 
don't contain it)?

Is it a licensing issue, something to do with the ODBC spec, or just plain 
don't want to do that, so there (which, I hasten to add, is perfectly 
acceptable)?

Just curious.

Kevin

-
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: MYSQL-based commerce packages

2001-12-11 Thread Kevin Donnelly

Have you had a look at The Exchange Project?
www.theexchangeproject.org

Kevin

On Wednesday 05 December 2001 22:07, rory o'connor wrote:
 I'm looking for a new commerce package, something run of a MySQL database.
 it's gotta have bulletproof (well, as close as you can get) session
 management.  I wonder what others on the list are using and like?  input is
 appreciated!


-
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




Fwd: Re: newbie. can't run safe_mysqld

2001-12-10 Thread Kevin Donnelly

Hi Mike

 This command executes and immediately ends:
  safe_mysqld --log 

 [2] 855
 root@linux:/var/lib/mysql  Starting mysqld daemon with databases from
 /var/lib/mysql
 04 07:45:16 mysqld ended

 This command seems to run quite nicely:
  safe_mysqld --skip-grant-tables 

 Now the manual informs me to From mysql, manually execute the
 SQL commands in mysql_install_db.

 1) Huh ? (I am a Linux newbie - don't know how)
 2) Can the mysql_install_db script be troubleshot and corrected ?
 3) Will a newer version of MySQL run better on my SuSE Linux 7.1
 machine ?

First, calm down.

I gather you're running SuSE 7.1.  In that case, do you have the CDs?  MySQL
can be a bit of a bind for beginners (I should know) until you get used to
it, and it is easiest to get started with the version on the CDs.  Then, once
you are used to it, you can update to new versions (or a new boxed version of
SuSE, which will include them).

I am on 7.3, but looking at my notes for 7.1 I see I had the same problem.
The solution is probably similar.  Basically, you need to run
mysql_install_db first, to create the user db that MySQL needs in order to
start the daemon - that is why it is exiting unstarted.

So, install your packages.  Then go to wherever they are installed (if you
are using the SuSE CDs, this was in /usr/bin).  As root, run:
mysql_install_db
(running as user will give errors).  You should get messages about the
various tables being created.

Then (as root) run:
safe_mysqld 
You should get no daemon ended message.

You then need to set the password for the root user (mysqladmin -u root
password whatever).  This is the standard method, but I have found that it
can end up giving you error messages about root@localhost not being allowed
access, which are confusing to a new user.  (The errors are because you also
need to specify the host).  So what I do is log on to MySQL without setting
the root password (mysql), and then run:
update user set password=password(whatever) where user=root;
and then:
flush privileges;
Exit, and log in again using root and the password.
The above sets the same password for both host entries (hostname and
localhost), so you don't have any hassle.

To see what I mean, logon as root and run:
use mysql;
select user,host,password from user;.

You should then delete the blank users (delete from user where user=;, and
then: flush privileges;).  To get MySQL to start automatically at boot, use
YaST (System Admin - Change config file) to set START_MYSQL to yes.

Try this, and see how it goes.  You won't want to go back to Access, believe
me!  You can do simple queries really easily in Access, but to do anything
more you need to use SQL in some form, and you might as well use a proper SQL
db for that.

As GIU clients for MySQL, I would recommend KMySQL on Linux, and MySQLFront
on Windows.

If you have further issues, post them to the list, and also separately to me.

Best wishes

Kevin



-
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: Database Syncronization

2001-12-10 Thread Kevin Donnelly

On Monday 10 December 2001 10:30, Benjamin Pflugmann wrote:
 You may want to have a look at replication in the fine manual:
 http://www.mysql.com/doc/R/e/Replication.html

A lot of info there!  But it seems to apply mainly to v4.  I'm not sure of 
Ananth's situation, but what I want to do is have dbs on a web site 
periodically synced to the same dbs on a LAN db server which is on dialup.  
Both are using v3.22.27, and are on *nix.

I was thinking of having a cron job on the website to dump the dbs, and then 
another cron job on the lan box to dial up, download the dump, and then 
update the local dbs (if that is possible - otherwise it could be done 
manually, I suppose).

Is there any more elegant method to do this?

TIA

Kevin

-
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: PHP+MYSQL: unable to select database

2001-12-10 Thread Kevin Donnelly

One of three issues:
1 - the db is not set up correctly;
2 - the user is not set up correctly;
3 - the PHP script is not calling the db properly - this could be due to 
wrong syntax, misnaming of the db table, or incorrect username parameters.

You would need to post some more info, in particular the script.  I would 
start at 1 at this point - have you set up the db on your webserver according 
to the instructions that came with the guestbook script?

Kevin

On Monday 10 December 2001 09:07, josep wrote:
  I get:

  unable to select database

  when I visit my guestbook.php

  The user trying it is set in the mysql.user (without any perms) and in the
  mysql.db (with all perms).

 Do I have to set all perms to this user in the mysql.user table?

-
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: Can't start up MySql

2001-12-10 Thread Kevin Donnelly

Can you give some more info?
Eg what is Fink, what distro are you using, how can you install if you don't 
have perms for the directory, etc.

Kevin

On Saturday 08 December 2001 15:17, Espen Isaksen wrote:
 I installed MySql through Fink but now that I try to start up I type
 mysqld at the
 prompt, but all I get is this:

 I do not have permissions to get into the directory myself.

-
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: PHP+MYSQL: unable to select database

2001-12-10 Thread Kevin Donnelly

Hi Josep

We have to be clear about definitions.

You seem to be making a couple of mistakes here:
1 - guestbook.sql is not the db, but probably a script to create the db (you
can check by opening it in a text-editor - it will probably have a CREATE
TABLE statement at the top, then the field definitions, then perhaps some
INSERT statements);
2 - the db does not usually reside in the user's webroot.

This can all be sorted out, but you will have to proceed one step at a time.

First, what is the guestbook script you are using?
Second, have you uploaded all the relevant files to your webserver, and made
any configuration changes necessary?
Third, how do you access MySQL on your webserver - via telnet/SSH, or via
MyPHPAdmin?

If you're not sure about the third, stop there and come back.

Fourth, have you created the db using MySQL on the webserver? This usually
involves:
* uploading the .dmp or .sql to the server (not necessarily to the webroot,
but perhaps to your FTP area);
* creating a db: mysqladmin -uroot -p create
mydatabase;
* logging onto MySQL and populating the database from the supplied script:
mysql -uroot -p mydatabase  /path/to/database.sql.

If you haven't done this, come back.

We'll take it from there.

Best wishes

Kevin

On Monday 10 December 2001 11:44, you wrote:
 I think didn't set the database correctly.
 The data base is set in the mysql.db with select_perms for the user.

 the user is able to connect to the server with the command line but unable
 to select the table:
 mysql select * from guestbook.sql

 TABLE DOES NOT EXIST

 One cuestion: where should be placed the db? (now is placed in the
 public_html dir of the user.

---

-
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: Parallel queries in PHP program

2001-12-10 Thread Kevin Donnelly

So far as I know, yes.  You need to set up two different connection strings, 
though, and reference those in the different queries.

Kevin



On Friday 07 December 2001 08:14, Ares Liu wrote:
 Can I implement parallel queries to mySQL by using sevial query sentences
 in a single PHP file? Who knows how to do it? including query the same
 table or different tables in parallel.

-
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: lost in the Land of Oz Parking Lot

2001-11-12 Thread Kevin Donnelly

Hi Jason

On Friday 09 November 2001 00:26, [EMAIL PROTECTED] wrote:
   I am lost.   I am a very VERY green newbie, and I am struggling on just
 how to begin.   Basically, I have bought a book, entitled, PHP and MYSQL
 Web Development . ,  I have downloaded mysql-3.23.43.tar.gz, the install
 for windows document (yes I have not even made it passed the Install!   Oh
 I am PATHETIC!) says to use Setup.exe for windows.  The problem is I can
 not find that file anywhere.

This is a very good book indeed.  But since you confess to being an absolute 
beginner (aren't we all?), I wonder whether I might point you in the 
direction of a book specifically for beginners.  It is PHP Fast and Easy, by 
Julie Meloni, pubished by PrimaTech.  It comes with a CD with all the stuff 
on it (although probably a bit dated by now - it's been out for a year), and 
detailed install instructions (everything went on first-time on Win95, once 
I'd updated the winsock to v2, so Win98 should have no problems at all).  
Only about 10 or 11 different types of page are covered, but they each have 
step-by-step walkthroughs, and I was able to read the whole book through 
without getting lost.  Once you've done that, you'll have a good basis for 
going on to Welling and Thomson.

HTH

Kevin

-
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




v3: delete based on select

2001-11-12 Thread Kevin Donnelly

I'm using 3.23.37, and I am taking a random subset of records from a table, 
and putting them into another table:
insert into targettable select * from sourcetable;

I then want to delete these records from the source table.  I have tried 
various permutations of:
delete from sourcetable select * from sourcetable,targettable where 
sourcetable.id=targettable.id;
but with no luck.

The archive only seems to have questions relating to multi-table deletes in 
v4, and there is nothing about this in the manual or in Carsten's FAQ.  Is 
there a way of doing this?

TIA

Kevin

-
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