php-windows Digest 18 Jan 2003 15:13:13 -0000 Issue 1542
Topics (messages 17955 through 17961):
Re: SQL-query
17955 by: Sean Malloy
17956 by: Dash McElroy
17957 by: Sean Malloy
mysql tools lost .......
17958 by: toby z
17959 by: Sean Malloy
Getting HTML Content as a variable
17960 by: php.interdatacentral.com
cookies problem
17961 by: Ed
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I'd fire any person working for me who was writing their own code to handle
incrementing a unique ID field.
If you have to insert a record after deleting one, with the same id, you
have some serious relationship issues in your data.
And if you _REALLY_ have to, then lock the data, turn auto increment off,
insert the record, turn auto increment back on, and unlock the data
Yes, you can disable auto increment fields for mass inserts, and then
re-enable them after.
-----Original Message-----
From: Cam Dunstan [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 18 January 2003 10:56 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] SQL-query
Amen to that - I really believe you are better off (if you have the freedom
to do so) changing autoincrement fields to an integer type and managing the
incrementing yourself. In addition to the problem Dash mentions there is
yet another "gotcha" - if you are ever faced with having to combine two
tables of existing data, each with an autoincrement fields you have a
serious problem on your hands and a lot of sweat work to change all the
related tables before you combine them. If I was Prime Minister I would
immediately pass legislation outlawing autoincrement fields ( my chances are
not good however).
----- Original Message -----
From: "Dash McElroy" <[EMAIL PROTECTED]>
To: "Piotr Pluciennik" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, January 18, 2003 4:54 AM
Subject: Re: [PHP-WIN] SQL-query
> Piotr is right. SQL shouldn't let you do that, if only for possible
> consistency errors. Imagine if you had id 3 referenced in some other table
> and then you put new data in the primary table with id of 3. Then all the
> other stuff referring to 3 would then refer to the new data. Not a good
> thing.
>
> I've been digging through an SQL book lately... some mind bending (but
> extremely logical) information.
>
> -Dash
>
> Don't look back, the lemmings are gaining on you.
>
> On Fri, 17 Jan 2003, Piotr Pluciennik wrote:
>
> > Hi,
> >
> > I don't use MYSQL, but the problem is common for
> > databases. One of the idea of auto increment field is
> > to have unique identifiers, so you can't insert a
> > record with auto increment fields set by yourself.
> > It's always done by DB. So you can't fill a "hole" in
> > numbering after deleting record. Of course in a normal
> > way of using DB... :-)
> >
> > HTH
> >
> > Piotr
> >
> > --- Bobo Wieland <[EMAIL PROTECTED]> wrote:
> > > I hope this isn't to much OT... Sorry if it is...
> > >
> > > In my MySQL-db that I use for a php-driven site I
> > > have many tables with the
> > > Primary Key set as an auto increment value.
> > >
> > > If I have 4 records with id 1, 2, 3 and 4 and then
> > > delete number 3 and add
> > > one more record I get the id's 1,2,4 and 5. It isn't
> > > much of a problem, but
> > > it would be nice to check for the first "hole" in
> > > the id's and insert the
> > > record there instead. How would you do this? is
> > > there some simple way from
> > > either MySQl or PHP that doesn't take to much time
> > > to execute?
> > >
> > > thanks in advance
> > >
> > >
> > > . bobo . www.elstudion.com . [EMAIL PROTECTED] .
> > >
> > >
> > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > http://mailplus.yahoo.com
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Uhm, I was actually in favor of auto_increment fields... auto_increment
should protect against data inconsistency by providing a unique and new
number for new data so it does not "inherit" old data (in other tables).
If you really wanted to do your own auto_increment, it wouldn't be hard,
but why add code when the database can do that for you? Just do a select
max(`id`) from `tablename`, although that wouldn't find an open one.
Combining data from two tables with auto_increment fields sounds dangerous
and a prime candidate for inserting consistency errors.
-Dash
The hardest thing in the world to understand is the income tax.
-- Albert Einstein
On Sat, 18 Jan 2003, Cam Dunstan wrote:
>
> Amen to that - I really believe you are better off (if you have the freedom
> to do so) changing autoincrement fields to an integer type and managing the
> incrementing yourself. In addition to the problem Dash mentions there is
> yet another "gotcha" - if you are ever faced with having to combine two
> tables of existing data, each with an autoincrement fields you have a
> serious problem on your hands and a lot of sweat work to change all the
> related tables before you combine them. If I was Prime Minister I would
> immediately pass legislation outlawing autoincrement fields ( my chances are
> not good however).
>
>
>
> ----- Original Message -----
> From: "Dash McElroy" <[EMAIL PROTECTED]>
> To: "Piotr Pluciennik" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, January 18, 2003 4:54 AM
> Subject: Re: [PHP-WIN] SQL-query
>
>
> > Piotr is right. SQL shouldn't let you do that, if only for possible
> > consistency errors. Imagine if you had id 3 referenced in some other table
> > and then you put new data in the primary table with id of 3. Then all the
> > other stuff referring to 3 would then refer to the new data. Not a good
> > thing.
> >
> > I've been digging through an SQL book lately... some mind bending (but
> > extremely logical) information.
> >
> > -Dash
> >
> > Don't look back, the lemmings are gaining on you.
> >
> > On Fri, 17 Jan 2003, Piotr Pluciennik wrote:
> >
> > > Hi,
> > >
> > > I don't use MYSQL, but the problem is common for
> > > databases. One of the idea of auto increment field is
> > > to have unique identifiers, so you can't insert a
> > > record with auto increment fields set by yourself.
> > > It's always done by DB. So you can't fill a "hole" in
> > > numbering after deleting record. Of course in a normal
> > > way of using DB... :-)
> > >
> > > HTH
> > >
> > > Piotr
> > >
> > > --- Bobo Wieland <[EMAIL PROTECTED]> wrote:
> > > > I hope this isn't to much OT... Sorry if it is...
> > > >
> > > > In my MySQL-db that I use for a php-driven site I
> > > > have many tables with the
> > > > Primary Key set as an auto increment value.
> > > >
> > > > If I have 4 records with id 1, 2, 3 and 4 and then
> > > > delete number 3 and add
> > > > one more record I get the id's 1,2,4 and 5. It isn't
> > > > much of a problem, but
> > > > it would be nice to check for the first "hole" in
> > > > the id's and insert the
> > > > record there instead. How would you do this? is
> > > > there some simple way from
> > > > either MySQl or PHP that doesn't take to much time
> > > > to execute?
> > > >
> > > > thanks in advance
> > > >
> > > >
> > > > . bobo . www.elstudion.com . [EMAIL PROTECTED] .
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > > http://mailplus.yahoo.com
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Why the hell would you want to do that?
It looks ugly?
I'll tell you what, when you have 80000 records in the database, and #34,501
is missing, I wonder if you'll notice, or want to write code to fill, the
"hole"
if you really want to fix the hole (as much as I think you are seriously
wasting your time, and a sneaking suspicion as to why you would actually
want to do it)..
You would have to pull the data down into an arrya, loop through the array
from start to finish, all the while checking if the current ID equals the
counter value, as soon as it doesn't, you know you have found an ID you can
insert into the DB safely. Ofcourse, if there are records in other tables
related by that ID, and you forgot to delet those, you'll get some really
weird results.
Not to mention the extra time your code would be taking to execute.
if I saw someone writing all the code to patch holes in record sequences, I
would fire them. But thats just me. I'd rather have my employees working on
making things better, not slower for no reason at all other than 'i like
pretty sequences'
However, I'm guessing its because you actually want to create < PREV | NEXT
> next buttons, and you can't think of a way to link up the records.
If thats the case, email me back, and I'll send you some example code which
should (perhaps), make your life much simpler.
-----Original Message-----
From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
Sent: Friday, 17 January 2003 10:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] SQL-query
I hope this isn't to much OT... Sorry if it is...
In my MySQL-db that I use for a php-driven site I have many tables with the
Primary Key set as an auto increment value.
If I have 4 records with id 1, 2, 3 and 4 and then delete number 3 and add
one more record I get the id's 1,2,4 and 5. It isn't much of a problem, but
it would be nice to check for the first "hole" in the id's and insert the
record there instead. How would you do this? is there some simple way from
either MySQl or PHP that doesn't take to much time to execute?
thanks in advance
. bobo . www.elstudion.com . [EMAIL PROTECTED] .
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
hi guys im stuck bad as usual .....
mysql.com and datanamic.com r both down ...... god alone knoz y they
both had to go down when i despretely needed em
is there any other tool to design a mysql db so that its sql gets
generated jst as the designning is done ?????
or cud anyone tell me anyother site that lets dezign for databases (v
2.5.2) downloaded not from datanamic
the only version at cnet is 2.4 :S
i cant even install rational rose though i aint sure if it does what
i want it do ....
note : what ever it is it has to b free .... :(
thnx a mill
desprete n lost ..... as ever .....
toby ....
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--- End Message ---
--- Begin Message ---
http://www.dbtools.com.br
-----Original Message-----
From: toby z [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 18 January 2003 4:33 PM
To: php hlp list
Subject: [PHP-WIN] mysql tools lost .......
hi guys im stuck bad as usual .....
mysql.com and datanamic.com r both down ...... god alone knoz y they
both had to go down when i despretely needed em
is there any other tool to design a mysql db so that its sql gets
generated jst as the designning is done ?????
or cud anyone tell me anyother site that lets dezign for databases (v
2.5.2) downloaded not from datanamic
the only version at cnet is 2.4 :S
i cant even install rational rose though i aint sure if it does what
i want it do ....
note : what ever it is it has to b free .... :(
thnx a mill
desprete n lost ..... as ever .....
toby ....
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
I've been directed to use file() or implode() to get the html content of a web page,
like this: $html = implode ('', file ('http://192.168.1.100/PHP/index.php'));
1 ) How do I pass authentication to websites that require username & password? In Cold
Fusion the CFHTTP tag allows you to pass USERNAME="myusername" PASSWORD="mypassword",
there must be an equivalent parameter in PHP.
2) When I output the content of $html, which is the web page stored as a variable, the
images are not there. Again, in Cold Fusion the CFHTTP tag takes care of this when you
specify RESOLVEURL="YES", and I'm guessing there is a way in PHP to store the web page
WITH images intact?
thanks! ph_Greg
--- End Message ---
--- Begin Message ---
I seem to be having a problem with cookies not being saved and I'm using
W2k, IIS 5.0, with php 4.3. I just upgraded from a previous version of php
that worked fine. Anyone had this problem or know of a solution?
Thanks,
Ed
--- End Message ---