[PHP-DB] php5/MySQL 4.1.1 connection error

2004-02-04 Thread kengaun
Hi, I am testing to use php5.0.0b3 and connect to MySQL 4.1.1 encountered connection problem:- ?php $link = mysqli_connect(localhost, purct, prcyct,purct) or die(Could not connect: . mysql_error()); echo Connected successfully; mysql_close($link); ? Error message:

[PHP-DB] Re: Subject: multiple fields all unique?

2004-02-04 Thread Neil Smth
Jason - you posted this a 5 weeks ago and received several answers. http://www.phpdiscuss.com/article.php?id=32225group=php.db You say you have written your own code, but you have not attached it. As Peter said, the key is probably to declare those columns unique then allow the database to

Re: [PHP-DB] multiple fields all unique?

2004-02-04 Thread Jas
For this table to create 3 unique keys I did the following, in case it helps someone else out. +--+--+--+-+-++ | Field| Type | Null | Key | Default | Extra |

Re: [PHP-DB] multiple fields all unique? [almost solved]

2004-02-04 Thread Jas
Jas wrote: For this table to create 3 unique keys I did the following, in case it helps someone else out. +--+--+--+-+-++ | Field| Type | Null | Key | Default | Extra |

[PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread whynotpizza
Hi all. Question on running in a config with Apache2,PHP 4.3.4,MySQL 4.0.17 running on Linux Redhat 9.0. Basically I want to make sure that a DB insert or update is guarenteed to complete. So if a user hits submit on a webpage, the transaction under the hood completes, no matter if the user

Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread Matt Matijevich
snip So if a user hits submit on a webpage, the transaction under the hood completes, no matter if the user hits cancel or his browser dies or whatever. (Not sure how to even test this condition, but I know it will happen) /snip Once php has the request, hitting cancel on the browser or a browser

Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread Jason Wong
On Wednesday 04 February 2004 23:46, Matt Matijevich wrote: Once php has the request, hitting cancel on the browser or a browser dying will not stop the php script from executing all the way through. Actually whether the script runs through to completion depends on the 'ignore_user_abort'

Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread Matt Matijevich
snip Actually whether the script runs through to completion depends on the 'ignore_user_abort' setting. /snip wow, guess you learn something everyday. wish I would have known about that when I wrote a php script with some terrible (lots of joins, just poorly designed) queries that took down my

[PHP-DB] PEAR DB 1.6.0RC4 released. please test.

2004-02-04 Thread Daniel Convissor
Hi Folks: I just released version 1.6.0RC4 of PEAR DB. Several things have been fixed since RC1 which is included with the latest PHP RC release. Also, if you're using 1.5.0 variants or earlier, definitely check out the new version for loads of enhancements and way fewer bugs. I've also spent

Re: [PHP-DB] multiple fields all unique? [almost solved]

2004-02-04 Thread Jas
If I do this statement: mysql_query(UPDATE hosts SET hostname=\$_POST[hostname]\, mac=\$_POST[mac]\, ip=\$_POST[ip]\, vlan=\$_POST[vlan]\ WHERE id=\$_SESSION[id]\,$db)or die(mysql_error() . mysql_errno()); I get this error: Duplicate entry '128.110.22.139' for key 41062 I have tried using these

Re: [PHP-DB] multiple fields all unique?

2004-02-04 Thread John W. Holmes
From: Jas [EMAIL PROTECTED] Now I have used the following to check if duplicate records exist before updating: ?php // Try and update with posted fields form html form $update = mysql_query(UPDATE hosts SET hostname='$_POST[hostname]', mac='$_POST[mac]', ip='$_POST[ip]',

Re: [PHP-DB] multiple fields all unique? [almost solved]

2004-02-04 Thread John W. Holmes
From: Jas [EMAIL PROTECTED] for instance, say you change the mac and hostname and there is a record in the database with the same mac string, how can I flag the field that matched from the 3? Your update will actually fail in the case, so you need to catch the error with mysql_error() (and

Re: [PHP-DB] multiple fields all unique? [almost solved]

2004-02-04 Thread Jas
John W. Holmes wrote: [snip] When you update the table with an existing mac value, the error will be similar to Duplicate value for Key XX where XX is what key was duplicated. I can't remember if the keys start at zero or one, but your ID column will be the first key, then mac, hostname, and

Re: [PHP-DB] multiple fields all unique? [almost solved]

2004-02-04 Thread John W. Holmes
From: Jas [EMAIL PROTECTED] If I do this statement: mysql_query(UPDATE hosts SET hostname=\$_POST[hostname]\, mac=\$_POST[mac]\, ip=\$_POST[ip]\, vlan=\$_POST[vlan]\ WHERE id=\$_SESSION[id]\,$db)or die(mysql_error() . mysql_errno()); I get this error: Duplicate entry '128.110.22.139' for

Re: [PHP-DB] multiple fields all unique? [almost solved]

2004-02-04 Thread Jas
[snip] You're not going to be able to fetch anything from the result set because you're excuting an UPDATE query, not a SELECT. You also do not want to die() when the query fails, otherwise you won't be able to react to the error. Execute the query, then check mysql_error() for a value. If it

RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread whynotpizza
Thanks guys, this is great info. One last thought, Suppose I have several DB transactions that I want to treat as 1 logical transaction that I need to complete guarenteed. For instance, an INSERT to one table, and a DELETE to another, and an UPDATE to a third. All need to complete once a user

RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread Matt Matijevich
snip Suppose I have several DB transactions that I want to treat as 1 logical transaction that I need to complete guarenteed. For instance, an INSERT to one table, and a DELETE to another, and an UPDATE to a third. All need to complete once a user selects submit. What's the best approach to this

Res: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread Ricardo Oliveira
Hi, I had a similar problem andI solved it using transations, but I had to use InnoDB table types... Regards, Ricardo ---Mensagem original--- De: whynotpizza Data: 02/04/04 15:33:37 Para: [EMAIL PROTECTED] Assunto: [PHP-DB] apache/php/mysql - guarenteed DB transaction Hi all.

Res: RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction

2004-02-04 Thread Ricardo Oliveira
You should use set autocommit = 0; start transaction; insert code; delete code; update code; commit or rollback depending on the result; To do all this I had to use InnoDB table types. Sorry, my english is quite pour, Best regards, Ricardo ---Mensagem original--- De:

[PHP-DB] Re: php5/MySQL 4.1.1 connection error

2004-02-04 Thread kengaun
Hi ALL, MySql support is not bundled with PHP 5.0.0 I have managed to connect to MySQL after I have copied the new dll libmySQL.dll(in php/dlls) folder to c:\windows\system32 And modified the php.ini as per below. In php.ini ; Directory in which the loadable extensions (modules) reside.