php-general Digest 5 Mar 2006 02:02:00 -0000 Issue 3998
Topics (messages 231447 through 231459):
Re: Mysql Rows
231447 by: tedd
231448 by: Gustav Wiberg
231449 by: Robert Cummings
231451 by: benifactor
231452 by: benifactor
231453 by: tedd
231455 by: Robert Cummings
231456 by: jblanchard.pocket.com
231457 by: jblanchard.pocket.com
231458 by: Robert Cummings
php/mysql/phpMyAdmin on an iBook?
231450 by: Paul Jinks
Re: LDAP confusion
231454 by: jblanchard.pocket.com
output Today's date
231459 by: Paul Goepfert
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:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
planetthoughtful wrote:
But, too often I've seen people new to database design not liking
'gaps' because 'user1' will have a unique id of '1', while 'user2'
will have a unique id of '6' because the records associated with
unique ids '2' through '5' were deleted during testing, and so on.
So, they feel that 'user2' should have a unique id of '2', ignoring
the fact that that's not a unique id at all, if you had id '2'
associated with another record at some point.
And, Anthony wrote:
I remember the days where i'd
clear a database after testing to keep the auto_increment inline, but
eventually, you will get out of sync on that, so it's not a reliable way of
keeping a numerical sequence.
Well... I'm one of those people who don't like gaps. I understand
that if the dB is relational, then you shouldn't be concerned about
gaps. Gaps are only perceived from a perspective of an artificial
ordering system -- who knows where the data actually is in memory or
on disk.
However, when I'm working with a flat dB and want to step through the
records to do editing, I like the records to be in order based upon
an "id" (i.e., Record 1, Record 2, Record 3, and so on). I use an
auto_increment unique "id" for this.
It's not a big problem for me to keep the records in order either.
Whenever I delete a record, I simply follow with:
$dbQuery = "ALTER TABLE $dbtable ";
$dbQuery .= "DROP id, ";
$dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
$dbQuery .= "AUTO_INCREMENT = 1";
$result = mysql_query($dbQuery) or die("2. Could not renumber dB
$dbQuery" . mysql_error());
and my dB is in order and all things are right with the world again.
I'm simple-minded that way.
Now, I'm not allowing more one than one person (namely me) the
ability to delete and reorder things, so I don't think there are any
problems. Of course I could lock down the tables, delete, and then do
the reorder if the dB is online -- but I haven't encountered any
problems thus far.
I've read numerous dB books about why it isn't necessary to reorder
and everyone deplores the action, which is only done by newbies. But
I don't really understand, with a flat dB, as to why it's a bad idea
to do this?
Now, is there a problem with the way I'm doing this? If so, *please*
enlighten me. Please tell me why this isn't a reliable way of keeping
a numerical sequence AND what technique would be?
Many thanks.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "tedd" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Cc: "benifactor" <[EMAIL PROTECTED]>; "Murray @ PlanetThoughtful"
<[EMAIL PROTECTED]>; "Anthony Ettinger" <[EMAIL PROTECTED]>
Sent: Saturday, March 04, 2006 3:14 PM
Subject: Re: [PHP] Mysql Rows
planetthoughtful wrote:
But, too often I've seen people new to database design not liking 'gaps'
because 'user1' will have a unique id of '1', while 'user2' will have a
unique id of '6' because the records associated with unique ids '2'
through '5' were deleted during testing, and so on. So, they feel that
'user2' should have a unique id of '2', ignoring the fact that that's not
a unique id at all, if you had id '2' associated with another record at
some point.
And, Anthony wrote:
I remember the days where i'd
clear a database after testing to keep the auto_increment inline, but
eventually, you will get out of sync on that, so it's not a reliable way
of
keeping a numerical sequence.
Well... I'm one of those people who don't like gaps. I understand that if
the dB is relational, then you shouldn't be concerned about gaps. Gaps are
only perceived from a perspective of an artificial ordering system -- who
knows where the data actually is in memory or on disk.
However, when I'm working with a flat dB and want to step through the
records to do editing, I like the records to be in order based upon an
"id" (i.e., Record 1, Record 2, Record 3, and so on). I use an
auto_increment unique "id" for this.
It's not a big problem for me to keep the records in order either.
Whenever I delete a record, I simply follow with:
$dbQuery = "ALTER TABLE $dbtable ";
$dbQuery .= "DROP id, ";
$dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
$dbQuery .= "AUTO_INCREMENT = 1";
$result = mysql_query($dbQuery) or die("2. Could not renumber dB $dbQuery"
. mysql_error());
and my dB is in order and all things are right with the world again. I'm
simple-minded that way.
Now, I'm not allowing more one than one person (namely me) the ability to
delete and reorder things, so I don't think there are any problems. Of
course I could lock down the tables, delete, and then do the reorder if
the dB is online -- but I haven't encountered any problems thus far.
I've read numerous dB books about why it isn't necessary to reorder and
everyone deplores the action, which is only done by newbies. But I don't
really understand, with a flat dB, as to why it's a bad idea to do this?
Now, is there a problem with the way I'm doing this? If so, *please*
enlighten me. Please tell me why this isn't a reliable way of keeping a
numerical sequence AND what technique would be?
Many thanks.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi Tedd!
Generally speaking about db's it's not a good pratice to do in that you
describe, but as I understand you've already figured that out...
But one thing not doing "your" way is lack of performance:
I'll quote you:
"not a big problem for me to keep the records in order either.
Whenever I delete a record, I simply follow with:
$dbQuery = "ALTER TABLE $dbtable ";
$dbQuery .= "DROP id, ";
$dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
$dbQuery .= "AUTO_INCREMENT = 1";
$result = mysql_query($dbQuery) or die("2. Could not renumber dB $dbQuery"
. mysql_error());"
No, maybe not when it's a small db, but when you try to delete 50.000 posts
I have a strong feeling this would be very much slower then if you don't
alter table after each deletion.
/G
--- End Message ---
--- Begin Message ---
On Sat, 2006-03-04 at 09:14, tedd wrote:
> planetthoughtful wrote:
>
> >But, too often I've seen people new to database design not liking
> >'gaps' because 'user1' will have a unique id of '1', while 'user2'
> >will have a unique id of '6' because the records associated with
> >unique ids '2' through '5' were deleted during testing, and so on.
> >So, they feel that 'user2' should have a unique id of '2', ignoring
> >the fact that that's not a unique id at all, if you had id '2'
> >associated with another record at some point.
>
> And, Anthony wrote:
>
> >I remember the days where i'd
> >clear a database after testing to keep the auto_increment inline, but
> >eventually, you will get out of sync on that, so it's not a reliable way of
> >keeping a numerical sequence.
>
> Well... I'm one of those people who don't like gaps. I understand
> that if the dB is relational, then you shouldn't be concerned about
> gaps. Gaps are only perceived from a perspective of an artificial
> ordering system -- who knows where the data actually is in memory or
> on disk.
>
> However, when I'm working with a flat dB and want to step through the
> records to do editing, I like the records to be in order based upon
> an "id" (i.e., Record 1, Record 2, Record 3, and so on). I use an
> auto_increment unique "id" for this.
>
> It's not a big problem for me to keep the records in order either.
> Whenever I delete a record, I simply follow with:
>
> $dbQuery = "ALTER TABLE $dbtable ";
> $dbQuery .= "DROP id, ";
> $dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
> $dbQuery .= "AUTO_INCREMENT = 1";
> $result = mysql_query($dbQuery) or die("2. Could not renumber dB
> $dbQuery" . mysql_error());
*LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
you never get your hands on a real database with millions of entries.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "tedd" <[EMAIL PROTECTED]>
Cc: "PHP-General" <php-general@lists.php.net>; "benifactor"
<[EMAIL PROTECTED]>; "Murray @ PlanetThoughtful" <[EMAIL PROTECTED]>;
"Anthony Ettinger" <[EMAIL PROTECTED]>
Sent: Saturday, March 04, 2006 9:41 AM
Subject: Re: [PHP] Mysql Rows
> On Sat, 2006-03-04 at 09:14, tedd wrote:
> > planetthoughtful wrote:
> >
> > >But, too often I've seen people new to database design not liking
> > >'gaps' because 'user1' will have a unique id of '1', while 'user2'
> > >will have a unique id of '6' because the records associated with
> > >unique ids '2' through '5' were deleted during testing, and so on.
> > >So, they feel that 'user2' should have a unique id of '2', ignoring
> > >the fact that that's not a unique id at all, if you had id '2'
> > >associated with another record at some point.
> >
> > And, Anthony wrote:
> >
> > >I remember the days where i'd
> > >clear a database after testing to keep the auto_increment inline, but
> > >eventually, you will get out of sync on that, so it's not a reliable
way of
> > >keeping a numerical sequence.
> >
> > Well... I'm one of those people who don't like gaps. I understand
> > that if the dB is relational, then you shouldn't be concerned about
> > gaps. Gaps are only perceived from a perspective of an artificial
> > ordering system -- who knows where the data actually is in memory or
> > on disk.
> >
> > However, when I'm working with a flat dB and want to step through the
> > records to do editing, I like the records to be in order based upon
> > an "id" (i.e., Record 1, Record 2, Record 3, and so on). I use an
> > auto_increment unique "id" for this.
> >
> > It's not a big problem for me to keep the records in order either.
> > Whenever I delete a record, I simply follow with:
> >
> > $dbQuery = "ALTER TABLE $dbtable ";
> > $dbQuery .= "DROP id, ";
> > $dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
> > $dbQuery .= "AUTO_INCREMENT = 1";
> > $result = mysql_query($dbQuery) or die("2. Could not renumber dB
> > $dbQuery" . mysql_error());
>
> *LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
> syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
> you never get your hands on a real database with millions of entries.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
my reasoning for needing the users number in a database is this...
i am going to be doing a lottery type thing where i grab a random number
between 1 and the result of mysql_num_rows($result)... that is the reason
the gaps matter. the while loop didn't work for me so if anyone could help
me out on how to get this number i would aprreaciate it. thank you in
advance.
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "benifactor" <[EMAIL PROTECTED]>
To: "Robert Cummings" <[EMAIL PROTECTED]>; "tedd" <[EMAIL PROTECTED]>
Cc: "PHP-General" <php-general@lists.php.net>; "Murray @ PlanetThoughtful"
<[EMAIL PROTECTED]>; "Anthony Ettinger" <[EMAIL PROTECTED]>
Sent: Saturday, March 04, 2006 2:29 PM
Subject: Re: [PHP] Mysql Rows
>
> ----- Original Message -----
> From: "Robert Cummings" <[EMAIL PROTECTED]>
> To: "tedd" <[EMAIL PROTECTED]>
> Cc: "PHP-General" <php-general@lists.php.net>; "benifactor"
> <[EMAIL PROTECTED]>; "Murray @ PlanetThoughtful" <[EMAIL PROTECTED]>;
> "Anthony Ettinger" <[EMAIL PROTECTED]>
> Sent: Saturday, March 04, 2006 9:41 AM
> Subject: Re: [PHP] Mysql Rows
>
>
> > On Sat, 2006-03-04 at 09:14, tedd wrote:
> > > planetthoughtful wrote:
> > >
> > > >But, too often I've seen people new to database design not liking
> > > >'gaps' because 'user1' will have a unique id of '1', while 'user2'
> > > >will have a unique id of '6' because the records associated with
> > > >unique ids '2' through '5' were deleted during testing, and so on.
> > > >So, they feel that 'user2' should have a unique id of '2', ignoring
> > > >the fact that that's not a unique id at all, if you had id '2'
> > > >associated with another record at some point.
> > >
> > > And, Anthony wrote:
> > >
> > > >I remember the days where i'd
> > > >clear a database after testing to keep the auto_increment inline, but
> > > >eventually, you will get out of sync on that, so it's not a reliable
> way of
> > > >keeping a numerical sequence.
> > >
> > > Well... I'm one of those people who don't like gaps. I understand
> > > that if the dB is relational, then you shouldn't be concerned about
> > > gaps. Gaps are only perceived from a perspective of an artificial
> > > ordering system -- who knows where the data actually is in memory or
> > > on disk.
> > >
> > > However, when I'm working with a flat dB and want to step through the
> > > records to do editing, I like the records to be in order based upon
> > > an "id" (i.e., Record 1, Record 2, Record 3, and so on). I use an
> > > auto_increment unique "id" for this.
> > >
> > > It's not a big problem for me to keep the records in order either.
> > > Whenever I delete a record, I simply follow with:
> > >
> > > $dbQuery = "ALTER TABLE $dbtable ";
> > > $dbQuery .= "DROP id, ";
> > > $dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
> > > $dbQuery .= "AUTO_INCREMENT = 1";
> > > $result = mysql_query($dbQuery) or die("2. Could not renumber dB
> > > $dbQuery" . mysql_error());
> >
> > *LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
> > syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
> > you never get your hands on a real database with millions of entries.
> >
> > Cheers,
> > Rob.
> > --
> > .------------------------------------------------------------.
> > | InterJinn Application Framework - http://www.interjinn.com |
> > :------------------------------------------------------------:
> > | An application and templating framework for PHP. Boasting |
> > | a powerful, scalable system for accessing system services |
> > | such as forms, properties, sessions, and caches. InterJinn |
> > | also provides an extremely flexible architecture for |
> > | creating re-usable components quickly and easily. |
> > `------------------------------------------------------------'
> >
>
> my reasoning for needing the users number in a database is this...
>
> i am going to be doing a lottery type thing where i grab a random number
> between 1 and the result of mysql_num_rows($result)... that is the reason
> the gaps matter. the while loop didn't work for me so if anyone could
help
> me out on how to get this number i would aprreaciate it. thank you in
> advance.
here is what i tried..
while ($d = mysql_fetch_array($query)) {
$i = 0;
while ($d[username] != $user) {
$i++
}
}
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi:
Gustav said:
No, maybe not when it's a small db, but when you try to delete
50.000 posts I have a strong feeling this would be very much slower
then if you don't alter table after each deletion.
First, I'm not deleting 50,000 records -- I dropping a table and
renumbering it.
In any event, I just tested your claim on my host and I was able to
renumber 50,000 records in less than 1/2 second. Even though I tried
it several times, the results were never above 0.47 seconds. If I was
dealing with a database that was accessible to others, then I would
either lock tables or use transaction and then renumber -- but in
either case the difference in time is less than additional 1/10 of a
second.
I don't know if 1/2 second is a big deal in your world, or not, but
it seems a bit slow to me. I wrote splay binary tree search routine
that would perform 100,000 searches in a two million record dB in
less than one second on my Mac. And if you know what a splay
algorithm is, then you also know that it not only preforms a search
but then reorders the tree each time a search is successful and thus
is very laborious. Yet the time it took to preform 100,000 searches
and reorders was still less than one second.
Perhaps my host is running something slower -- after all, I'm only
paying $7.00 per year for the service. But with all things
considered, a half second is not that significant with a small 50,000
record dB. That's probably less than the majority of web sites that
use MySQL, don't you think?
Rod said:
*LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
you never get your hands on a real database with millions of entries.
I'm glad that you were amused. Considering that I was talking about a
flat dB, then you have already shot yourself in the foot if your
"real database" is in the millions of entries and is flat. I hope to
God that normalization may be something you consider in your next
database design.
In any event, it's interesting that I posted a question here and I
expected some ribbing, but I also expected something of value.
If the ALTER TABLE statement is prone to error, then I would like to
know that and why. However, I suspect that claim isn't true, it's
just that it's misuse has generated an urban myth of "Don't do that!
That's dangerous!" without any real substance other than for
programer error. Of course, I've run into windozes programmers who
accept the occasional crash and burn as "it comes with the
territory", but that's unfortunate to apply this "apprehension" to
MySQL.
In my previous post I pleaded for someone to point out the error of
my ways and to give me an alternative, but that hasn't happened yet
-- so, does anyone want to tell me why I should not renumber a flat
database and give me an alternative? I'm all ears...
Thanks in advance for any replies.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--- End Message ---
--- Begin Message ---
On Sat, 2006-03-04 at 17:34, benifactor wrote:
> ----- Original Message -----
> From: "benifactor" <[EMAIL PROTECTED]>
> To: "Robert Cummings" <[EMAIL PROTECTED]>; "tedd" <[EMAIL PROTECTED]>
> Cc: "PHP-General" <php-general@lists.php.net>; "Murray @ PlanetThoughtful"
> <[EMAIL PROTECTED]>; "Anthony Ettinger" <[EMAIL PROTECTED]>
> Sent: Saturday, March 04, 2006 2:29 PM
> Subject: Re: [PHP] Mysql Rows
>
>
> >
> > ----- Original Message -----
> > From: "Robert Cummings" <[EMAIL PROTECTED]>
> > To: "tedd" <[EMAIL PROTECTED]>
> > Cc: "PHP-General" <php-general@lists.php.net>; "benifactor"
> > <[EMAIL PROTECTED]>; "Murray @ PlanetThoughtful" <[EMAIL PROTECTED]>;
> > "Anthony Ettinger" <[EMAIL PROTECTED]>
> > Sent: Saturday, March 04, 2006 9:41 AM
> > Subject: Re: [PHP] Mysql Rows
> >
> >
> > > On Sat, 2006-03-04 at 09:14, tedd wrote:
> > > > planetthoughtful wrote:
> > > >
> > > > >But, too often I've seen people new to database design not liking
> > > > >'gaps' because 'user1' will have a unique id of '1', while 'user2'
> > > > >will have a unique id of '6' because the records associated with
> > > > >unique ids '2' through '5' were deleted during testing, and so on.
> > > > >So, they feel that 'user2' should have a unique id of '2', ignoring
> > > > >the fact that that's not a unique id at all, if you had id '2'
> > > > >associated with another record at some point.
> > > >
> > > > And, Anthony wrote:
> > > >
> > > > >I remember the days where i'd
> > > > >clear a database after testing to keep the auto_increment inline, but
> > > > >eventually, you will get out of sync on that, so it's not a reliable
> > way of
> > > > >keeping a numerical sequence.
> > > >
> > > > Well... I'm one of those people who don't like gaps. I understand
> > > > that if the dB is relational, then you shouldn't be concerned about
> > > > gaps. Gaps are only perceived from a perspective of an artificial
> > > > ordering system -- who knows where the data actually is in memory or
> > > > on disk.
> > > >
> > > > However, when I'm working with a flat dB and want to step through the
> > > > records to do editing, I like the records to be in order based upon
> > > > an "id" (i.e., Record 1, Record 2, Record 3, and so on). I use an
> > > > auto_increment unique "id" for this.
> > > >
> > > > It's not a big problem for me to keep the records in order either.
> > > > Whenever I delete a record, I simply follow with:
> > > >
> > > > $dbQuery = "ALTER TABLE $dbtable ";
> > > > $dbQuery .= "DROP id, ";
> > > > $dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
> > > > $dbQuery .= "AUTO_INCREMENT = 1";
> > > > $result = mysql_query($dbQuery) or die("2. Could not renumber dB
> > > > $dbQuery" . mysql_error());
> > >
> > > *LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
> > > syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
> > > you never get your hands on a real database with millions of entries.
> > >
> >
> > my reasoning for needing the users number in a database is this...
> >
> > i am going to be doing a lottery type thing where i grab a random number
> > between 1 and the result of mysql_num_rows($result)... that is the reason
> > the gaps matter. the while loop didn't work for me so if anyone could
> help
> > me out on how to get this number i would aprreaciate it. thank you in
> > advance.
>
> here is what i tried..
> while ($d = mysql_fetch_array($query)) {
> $i = 0;
> while ($d[username] != $user) {
> $i++
> }
> }
Now we can help you...
<?php
$query =
"SELECT "
." id, " // or whatever the id field is called.
." username " // not really needed since you get ID also.
."FROM "
." users "
."ORDER BY "
." RAND() "
."LIMIT "
." 1 ";
?>
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
[snip]
my reasoning for needing the users number in a database is this...
i am going to be doing a lottery type thing where i grab a random number
between 1 and the result of mysql_num_rows($result)... that is the
reason
the gaps matter. the while loop didn't work for me so if anyone could
help
me out on how to get this number i would aprreaciate it. thank you in
advance.
[/snip]
The one thing that no one has mentioned is that relational databases
will returns rows in whatever order they please if no ORDER BY is
specified. Generally, due to query caching, rows without an order by
will be returned in the same order nearly every time.
The better solution here is selecting the lowest ID and the highest ID
and selecting a random number between the two, checking for its
existence, and doing the operation again until it comes up with a valid
ID. This way it matters not what ID's exist in what order and you will
always get a valid ID to award the lottery to. Or you could do it all in
the query itself, if you wanted to be a true RDBMS master.
SELECT * FROM table ORDER BY RAND() LIMIT 1
See...no ID's or artificial ordering required.
--- End Message ---
--- Begin Message ---
[snip]
I'm glad that you were amused. Considering that I was talking about a
flat dB, then you have already shot yourself in the foot if your
"real database" is in the millions of entries and is flat. I hope to
God that normalization may be something you consider in your next
database design.
[/snip]
Normalization? I have a call records database with 100's of millions of
records in a single table. No further normalization is required or
needed. The records cannot be broken down any further. I think you may
be using normalization incorrectly here. And by "flat" database, do you
mean flat file database or just single table database?
[snip]
In any event, it's interesting that I posted a question here and I
expected some ribbing, but I also expected something of value.
[/snip]
A SQL question on a PHP mailing list usually gets more than ribbing. ;)
[snip]
If the ALTER TABLE statement is prone to error, then I would like to
know that and why. However, I suspect that claim isn't true, it's
just that it's misuse has generated an urban myth of "Don't do that!
That's dangerous!" without any real substance other than for
programer error. Of course, I've run into windozes programmers who
accept the occasional crash and burn as "it comes with the
territory", but that's unfortunate to apply this "apprehension" to
MySQL.
[/snip]
Re-numbering of database tables has been an acknowledged "bad practice"
for years for several reasons. Ask on any SQL list, including MySQL, and
you'll get tons of reasons not to do it.
[snip]
In my previous post I pleaded for someone to point out the error of
my ways and to give me an alternative, but that hasn't happened yet
-- so, does anyone want to tell me why I should not renumber a flat
database and give me an alternative? I'm all ears...
[/snip]
I think that my answer in previous e-mail demonstrates a couple of ways
that this could be done without re-numbering, even in a single table
database.
--- End Message ---
--- Begin Message ---
On Sat, 2006-03-04 at 18:58, tedd wrote:
> Hi:
>
> Rod said:
>
> >*LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
> >syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
> >you never get your hands on a real database with millions of entries.
>
> I'm glad that you were amused. Considering that I was talking about a
> flat dB, then you have already shot yourself in the foot if your
> "real database" is in the millions of entries and is flat. I hope to
> God that normalization may be something you consider in your next
> database design.
That Rod guy, he's such a card! I'd add something, but Jay has already
covered my list in a more recent email than this one to which I'm
responding :)
Cheers,
R O B
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Hi everyone
I'm thinking of getting an iBook for reasons not really to do with
webbing but really need to do occasional php/mysql stuff to justify the
expense. I believe that they all come with an Apache testing server
installed and wondered if anyone had any success with getting
php/mysql/phpMyAdmin working on one of these machines.
Thanks in advance
Paul
--- End Message ---
--- Begin Message ---
[snip]
> if(!$ds=ldap_connect("foo")){
> echo "did not connect";
> }else {
> echo "connection successful";
> }
> $un = "user";
> $upw = "pass";
> echo "connect result is " . $ds . "<br />";
> ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
> ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
>
> if ($ds) {
> echo "Binding ...";
> if(!$r=ldap_bind($ds, $un, $upd)){
> echo "unable to verify</br>";
> }else{
> echo "verified<br>";
> }
>
> The result is always "verified".
>From the comments on www.php.net/ldap_bind:
I have found that if either of the valuse for user or password are
blank, or as in my case a typo resulted in a blank user as it was an
undefined variable, the ldap_bind() will just perform an anonymous
bind and return true!
You have:
$upw = "pass";
but using $upd in ldap_bind ...
if(!$r=ldap_bind($ds, $un, $upd)){
unless it's a typo in your example that could explain it. ?
[/snip]
It was a typo.
Anyhow, I guess if the connection to the server is anonymous in the
event of a bad username / pw combo I will still need to search the AD
for a match for authentication. I am still having a problem getting a
search to work.
--- End Message ---
--- Begin Message ---
Hi all,
ls there anyway I can set the date to the timezone of the clients
timezone? For example, if a person opens the web page at 3/6 12:01
EST and another person opens the same page at 3/5 10:01 MST I would
like the date to be the above days on the client computers. I know
everyone knows this but the way I described this the two people
accessed the webpage at the same time but I want the correct date for
the client computer to be outputted.
Thank you,
Paul
--- End Message ---