[PHP] Re: Novice MySQL problem
Jim Giner wrote: > > "drive view" wrote in message > news:cam4sn2ip7yncw2-2soq-vjk8suer7u5x96fvpeqoitkkcaj...@mail.gmail.com... >> Hi, >> >> I'm a novice to MySQL and am currently facing the following difficulty. >> I'm trying to update a table with a row of data the primary key of which >> is >> an ID which I believe is an auto incrementing serial number. My first >> question is how to check if this is the case. >> > > If you are updating a row, you should already know the id of the record, > so > in your update statement you reference it in the where clause. (ie, > "where rec_id = $curr_rec_key") > >> Secondly while trying to insert such a row leaving out this column mySql >> is >> inserting the row at ID 0 (the previous ID's in the table are from 1 to >> 9), >> but then will not take further inserts. >> >> Thanks for any help available. >> >> >> Regards >> >> Toni >> > > I don't know what the problem here is. Personally I never use auto-inc > fields. That statement tells us you have a poor understanding of the concept of relational databases, or you don't use relational tables. Cheers -- David Robley Sure, it's clean laundry. The cat's sitting on it, isn't he? Today is Pungenday, the 26th day of The Aftermath in the YOLD 3177. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Novice MySQL problem
Actually, no it doesn't, since I have a well-developed sense of all of that, but that's not helping to answer the OP's question now, is it? Stay on point. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Novice MySQL problem
Jim Giner wrote: > Actually, no it doesn't, since I have a well-developed sense of all of > that, but that's not helping to answer the OP's question now, is it? Stay > on point. Probably it helps the OP about as much as your statement that 'I don't know what the problem here is. Personally I never use auto-inc fields.' Cheers -- David Robley Useless Invention: Kickstand for a tank. Today is Pungenday, the 26th day of The Aftermath in the YOLD 3177. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice MySQL problem
On 14 Nov 2011, at 11:47, Jim Giner wrote: > Actually, no it doesn't, since I have a well-developed sense of all of > that, but that's not helping to answer the OP's question now, is it? Stay > on point. The OP's problem is solved, so the point is no longer relevant. I'm curious to know what your "well-developed sense of all of that" does when in lieu of auto-incrementing fields, and why. The only legitimate reason I've ever come across to avoid them is when you expect to need to partition data across multiple master DB servers. Is this why you avoid them? -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
On 12 November 2011 20:02, a dehqan wrote: > dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out > on Waiting for localhost ... . > But dio_write($handle, "AT\n") makes it prints AT exactly the same command > or A > A , .. > > On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa wrote: > >> are you sure about ATD03518726535\n? >> >> can you try if ( dio_write($handle, 'AT') )? >> > Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sniping on the List
Am concerned over the number of posts that appear to be from people trying to over-inflate their self-importance. If you are the world's best coder, then help those of us who aren't. If you happen to know a better way to do something that I'm struggling with, then please share it. But if you just want to take pot shots at us, then please keep your comments to yourself. To that end, I wish to thank Ashley Sheridan, Daniel P. Brown, Tedd Sperling and Tommy Pham, to name but just a few of those who have submitted incredibly-helpful posts, that I have kept for reference. Your contributions are very much appreciated - thanks. George Langley Interactive Developer www.georgelangley.ca
Re: [PHP] Sniping on the List
> If you are the world's best coder That would be me. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with proc_open and getmypid
Hello, I'm developing a PHP application that runs on GNU/Linux with php cli. A process must launch another one and store its pid, so I use proc_open and then proc_status to achieve that. The child process must also get its own pid and write it down to a file. After that, the calling process should compare both pids and they should match, but in fact they shoudln't. The problem is that when calling to proc_open like: $res = proc_open ("/usr/bin/php proc2.php", array(), $pipes); Two processes are created, one for the sh shell that launchs the php interpreter, and another for the php interpreter itself. Also, it seems like proc_get_status($res) returns the status of the sh, while getmypid in the second process returns the pid of the php interpreter. I wonder if there's anyway of do something of these: a) Get the pid of the php interpreter on proc_open instead of the sh one on the parent process, or... b) Get the pid of the sh process instead of the php interpreter on the child process. Or any manner in which two pids matches. Thanks a lot in advance, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice MySQL problem
On Mon, Nov 14, 2011 at 4:11 AM, Stuart Dallas wrote: > On 14 Nov 2011, at 11:47, Jim Giner wrote: > >> Actually, no it doesn't, since I have a well-developed sense of all of >> that, but that's not helping to answer the OP's question now, is it? Stay >> on point. > > The OP's problem is solved, so the point is no longer relevant. > > I'm curious to know what your "well-developed sense of all of that" does when > in lieu of auto-incrementing fields, and why. > > The only legitimate reason I've ever come across to avoid them is when you > expect to need to partition data across multiple master DB servers. Is this > why you avoid them? > > -Stuart > > -- > Stuart Dallas > 3ft9 Ltd > http://3ft9.com/ > > Even with clustering, not comparing inherent clustering technique between RDBMSes, consider the following (MySQL) table example: CREATE TABLE `my_cluster_sample` ( `pkID1_AutoInc` bigint(11) NOT NULL AUTO_INCREMENT, `pkID2_SrvrID` int(11) NOT NULL DEFAULT '1' COMMENT 'Use # of designated server ID', `name` varchar(50) NOT NULL, PRIMARY KEY (`pkID1_AutoInc`,`pkID2_SrvrID`) ) The only reason that I see where not to use integer types with auto increment for PK is when you have an insane _LARGE_ number of rows, in any given DB instance/server. Then, the integer type no longer applies and the use of GUID/UUID or other surrogate types comes in, aside from getting into hot debate/discussion about pros & cons of natural vs surrogate keys even if you don't have large amount of data ;) Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php