php-general Digest 17 Apr 2006 08:57:32 -0000 Issue 4076
Topics (messages 234086 through 234102):
Re: phpMyAdmin--resetting auto increments to 0
234086 by: Chuck Anderson
234087 by: tedd
234088 by: Chuck Anderson
234089 by: tedd
234090 by: Chuck Anderson
234092 by: Jay Blanchard
234096 by: Chuck Anderson
234097 by: Jay Blanchard
New Date/Time Functionality and Setting Timezones
234091 by: Chris
234101 by: Lester Caine
Table formation...
234093 by: Jay Blanchard
234094 by: chris smith
234095 by: Jay Blanchard
234099 by: Paul Novitski
234100 by: Jay Blanchard
Re: PHP Framework alternative ...
234098 by: Ligaya Turmelle
Re: 2 questions: Search in array and detect JS
234102 by: Jochem Maas
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 ---
alex wrote:
hi everyone
i have delete a few entries in my database as they were entered for testing
purposes and are no longer need (actually 102 entries)... and even thought
that db is empty i noticed that when the next entry went in the id number
went to 103
not 0 so i was wondering is it possible to somehow reset the value to
zero...
it is of int type and auto_increment
i have a few db's which id like to reset to zero i have tried placing a zero
enrty after deleting the lot but it only jumps to its next increment.
does anyone know what i mean...?
any help will be grateful
regards alex
On a related note (he did say PhpMyAdmin) ...
ALTER TABLE 'tablename' auto_increment=n works, but I can't get
PhpMyAdmin to reset the auto_increment through the Operations menu page.
If I go to the Operations tab for a table and set the auto_increment
value to something less that it currently is, PhpMyAdmin will not honor
my request and re-specifies the current auto_increment value in the
ALTER TABLE command (even though my requested value is valid).
Is this because of a config setting? I could have sworn earlier versions
would obey my request.
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
--- End Message ---
--- Begin Message ---
At 1:42 PM -0600 4/16/06, Chuck Anderson wrote:
alex wrote:
hi everyone
i have delete a few entries in my database as they were entered for
testing purposes and are no longer need (actually 102 entries)...
and even thought that db is empty i noticed that when the next
entry went in the id number went to 103
not 0 so i was wondering is it possible to somehow reset the value to zero...
it is of int type and auto_increment
i have a few db's which id like to reset to zero i have tried
placing a zero enrty after deleting the lot but it only jumps to
its next increment.
does anyone know what i mean...?
any help will be grateful
regards alex
On a related note (he did say PhpMyAdmin) ...
ALTER TABLE 'tablename' auto_increment=n works, but I can't get
PhpMyAdmin to reset the auto_increment through the Operations menu
page.
If I go to the Operations tab for a table and set the auto_increment
value to something less that it currently is, PhpMyAdmin will not
honor my request and re-specifies the current auto_increment value
in the ALTER TABLE command (even though my requested value is valid).
Is this because of a config setting? I could have sworn earlier
versions would obey my request.
Chuck:
This always works for me in PhpMyAdmin (I mistyped it before).
1. Delete the first record.
2. Reset the auto_increment in Operations to whatever you want.
3. Insert a record.
4. Delete that record.
After that, the next record will start at the new auto_increment
value. Don't ask why, that's just the way it works.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--- End Message ---
--- Begin Message ---
tedd wrote:
At 1:42 PM -0600 4/16/06, Chuck Anderson wrote:
alex wrote:
hi everyone
i have delete a few entries in my database as they were entered for
testing purposes and are no longer need (actually 102 entries)...
and even thought that db is empty i noticed that when the next
entry went in the id number went to 103
not 0 so i was wondering is it possible to somehow reset the value to zero...
it is of int type and auto_increment
i have a few db's which id like to reset to zero i have tried
placing a zero enrty after deleting the lot but it only jumps to
its next increment.
does anyone know what i mean...?
any help will be grateful
regards alex
On a related note (he did say PhpMyAdmin) ...
ALTER TABLE 'tablename' auto_increment=n works, but I can't get
PhpMyAdmin to reset the auto_increment through the Operations menu
page.
If I go to the Operations tab for a table and set the auto_increment
value to something less that it currently is, PhpMyAdmin will not
honor my request and re-specifies the current auto_increment value
in the ALTER TABLE command (even though my requested value is valid).
Is this because of a config setting? I could have sworn earlier
versions would obey my request.
Chuck:
This always works for me in PhpMyAdmin (I mistyped it before).
1. Delete the first record.
2. Reset the auto_increment in Operations to whatever you want.
3. Insert a record.
4. Delete that record.
After that, the next record will start at the new auto_increment
value. Don't ask why, that's just the way it works.
tedd
That would work, except that I want to change the auto_increment without
deleting the first record.
During testing I may add many entries to the end of an existing database
table. When I am done testing I want to delete those "extraneous"
entries (leaving the earlier entries intact). Call me
obsessive/compulsive or whatever, but I like to knock the auto_increment
value back down to the next valid value (what was the first "test" value).
PhpMyAdmin refuses to use the valid auto_increment value I specify in
Operations and I have to edit the query to set it right.
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
--- End Message ---
--- Begin Message ---
At 3:01 PM -0600 4/16/06, Chuck Anderson wrote:
tedd wrote:
At 1:42 PM -0600 4/16/06, Chuck Anderson wrote:
alex wrote:
hi everyone
i have delete a few entries in my database as they were entered
for testing purposes and are no longer need (actually 102
entries)... and even thought that db is empty i noticed that when
the next entry went in the id number went to 103
not 0 so i was wondering is it possible to somehow reset the
value to zero...
it is of int type and auto_increment
i have a few db's which id like to reset to zero i have tried
placing a zero enrty after deleting the lot but it only jumps to
its next increment.
does anyone know what i mean...?
any help will be grateful
regards alex
On a related note (he did say PhpMyAdmin) ...
ALTER TABLE 'tablename' auto_increment=n works, but I can't get
PhpMyAdmin to reset the auto_increment through the Operations menu
page.
If I go to the Operations tab for a table and set the
auto_increment value to something less that it currently is,
PhpMyAdmin will not honor my request and re-specifies the current
auto_increment value in the ALTER TABLE command (even though my
requested value is valid).
Is this because of a config setting? I could have sworn earlier
versions would obey my request.
Chuck:
This always works for me in PhpMyAdmin (I mistyped it before).
1. Delete the first record.
2. Reset the auto_increment in Operations to whatever you want.
3. Insert a record.
4. Delete that record.
After that, the next record will start at the new auto_increment
value. Don't ask why, that's just the way it works.
tedd
That would work, except that I want to change the auto_increment
without deleting the first record.
During testing I may add many entries to the end of an existing
database table. When I am done testing I want to delete those
"extraneous" entries (leaving the earlier entries intact). Call me
obsessive/compulsive or whatever, but I like to knock the
auto_increment value back down to the next valid value (what was the
first "test" value).
PhpMyAdmin refuses to use the valid auto_increment value I specify
in Operations and I have to edit the query to set it right.
Chuck:
Okay, then delete whatever record you want and reset the
auto_increment value to that -- for example: Let's say you have
records 0 - 100 that you want to keep. Then you added some test
records that went from 101 to 150 and now you want to delete those
records and start again at 101, right?
Simple, just:
1. Delete records 101-150.
2. Reset the auto_increment in Operations to 101
3. Insert a false record.
4. Delete that false record.
Now, your dB will be set to start at 101.
What's even more amazing (at least I've found), is that if you had
0-100 records you wanted to keep and 101-150 you wanted to delete,
but also had 151 to 200 you also wanted to keep, you could do what I
said above and the auto_increment would fill up 101-150 and then jump
to 201. It's neat the way it works. At least that's my memory. Try it.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--- End Message ---
--- Begin Message ---
tedd wrote:
At 3:01 PM -0600 4/16/06, Chuck Anderson wrote:
tedd wrote:
At 1:42 PM -0600 4/16/06, Chuck Anderson wrote:
alex wrote:
hi everyone
i have delete a few entries in my database as they were entered
for testing purposes and are no longer need (actually 102
entries)... and even thought that db is empty i noticed that when
the next entry went in the id number went to 103
not 0 so i was wondering is it possible to somehow reset the
value to zero...
it is of int type and auto_increment
i have a few db's which id like to reset to zero i have tried
placing a zero enrty after deleting the lot but it only jumps to
its next increment.
does anyone know what i mean...?
any help will be grateful
regards alex
On a related note (he did say PhpMyAdmin) ...
ALTER TABLE 'tablename' auto_increment=n works, but I can't get
PhpMyAdmin to reset the auto_increment through the Operations menu
page.
If I go to the Operations tab for a table and set the
auto_increment value to something less that it currently is,
PhpMyAdmin will not honor my request and re-specifies the current
auto_increment value in the ALTER TABLE command (even though my
requested value is valid).
Is this because of a config setting? I could have sworn earlier
versions would obey my request.
Chuck:
This always works for me in PhpMyAdmin (I mistyped it before).
1. Delete the first record.
2. Reset the auto_increment in Operations to whatever you want.
3. Insert a record.
4. Delete that record.
After that, the next record will start at the new auto_increment
value. Don't ask why, that's just the way it works.
tedd
That would work, except that I want to change the auto_increment
without deleting the first record.
During testing I may add many entries to the end of an existing
database table. When I am done testing I want to delete those
"extraneous" entries (leaving the earlier entries intact). Call me
obsessive/compulsive or whatever, but I like to knock the
auto_increment value back down to the next valid value (what was the
first "test" value).
PhpMyAdmin refuses to use the valid auto_increment value I specify
in Operations and I have to edit the query to set it right.
Chuck:
Okay, then delete whatever record you want and reset the
auto_increment value to that -- for example: Let's say you have
records 0 - 100 that you want to keep. Then you added some test
records that went from 101 to 150 and now you want to delete those
records and start again at 101, right?
Simple, just:
1. Delete records 101-150.
2. Reset the auto_increment in Operations to 101
3. Insert a false record.
4. Delete that false record.
Now, your dB will be set to start at 101.
What's even more amazing (at least I've found), is that if you had
0-100 records you wanted to keep and 101-150 you wanted to delete,
but also had 151 to 200 you also wanted to keep, you could do what I
said above and the auto_increment would fill up 101-150 and then jump
to 201. It's neat the way it works. At least that's my memory. Try it.
tedd
I appreciate your help here ..... but ....
2. Reset the auto_increment in Operations to 101
That's the part that PhpMyAdmin refuses to do. It will not alter it to
less than 151 (per your example).
PhpMyAdmin 2.6.4-pl3
It's not much work to then edit the PhpMyAdmin query to my liking, but I
don't think I used to have to do that.
I like your second part about filling in the between stuff. If I'm at
that point, though, I delete the auto_increment field (sorting the table
by date) and then add it back in. That fills all the gaps, too.
What I want to know is why PhpMyAdmin will not do your step 2. I swear
that earlier versions would let me do that.
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
****************************
--- End Message ---
--- Begin Message ---
[snip]
>2. Reset the auto_increment in Operations to 101
[/snip]
This isn't another of those 'reseting the auto-increment' holy war
questions where you use the AI number as an identifier for the record,
is it?
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
2. Reset the auto_increment in Operations to 101
[/snip]
This isn't another of those 'reseting the auto-increment' holy war
questions where you use the AI number as an identifier for the record,
is it?
Nope. And I have no intention of taking it there.
I just get obsessive and thorough when testing and then I don't like
stale data in my database - so I like to reset everything. It would be
better to backup before testing and then restore. Resetting the AI just
makes it the same as if you had.
And my real question is about PhpMyAdmin and why it no longer seems to
let you reset the AI using the Operations page. At least it doesn't on
my machine - Windows XP - Apache/2.0.55 - PhpMyAdmin 2.6.4-pl3.
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
--- End Message ---
--- Begin Message ---
[snip]
I just get obsessive and thorough when testing and then I don't like
stale data in my database - so I like to reset everything. It would be
better to backup before testing and then restore. Resetting the AI just
makes it the same as if you had.
[/snip]
I agree, that is why I truncate the tables after testing, if I am
testing on the production box.
[snip]
And my real question is about PhpMyAdmin and why it no longer seems to
let you reset the AI using the Operations page. At least it doesn't on
my machine - Windows XP - Apache/2.0.55 - PhpMyAdmin 2.6.4-pl3.
[/snip]
Hmmm....doesn't phpMyAdmin have a list or bug report? I know that a
bunch of us use it here...but this may be specific enough for the more
specific lists.
--- End Message ---
--- Begin Message ---
In more than one place in the PHP documentation it refers to the
order in which the new Date/Time functionality determines the
appropriate time zone.
That order is:
1) the value set by date_default_timezone_set(), if any
2) the TZ environmental variable
3) the date.timezone php.ini option
4) "magical guess"
5) UTC
Is this indeed the actual order?
Would it not make more sense to prioritize the date.timezone php.ini
setting over the TZ environmental variable?
That way users who don't have control over their TZ environmental
variable (such as might be the case with some shared hosting
environments) could set the timezone in an htaccess file rather than
having to ensure they call date_timezone_default_set() in every script.
Chris
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Chris wrote:
In more than one place in the PHP documentation it refers to the order
in which the new Date/Time functionality determines the appropriate
time zone.
That order is:
1) the value set by date_default_timezone_set(), if any
2) the TZ environmental variable
3) the date.timezone php.ini option
4) "magical guess"
5) UTC
Is this indeed the actual order?
Would it not make more sense to prioritize the date.timezone php.ini
setting over the TZ environmental variable?
That way users who don't have control over their TZ environmental
variable (such as might be the case with some shared hosting
environments) could set the timezone in an htaccess file rather than
having to ensure they call date_timezone_default_set() in every script.
Of cause this still does nothing for the vast majority of hosting, where
it's the timezone/daylight saving of the client that you need, not the
server :(
--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.
--- End Message ---
--- Begin Message ---
I know that this is simple, and again I am operating on little rest in
the quest to get a site launch by sometime tomorrow evening.
I have a table of data and I want to display items by two's, i.e.
Item 1 Item 2
Item 3 Item 4
Item 5
...and so on. I seem to remember doing this using mod to calculate if I
had divided by 2. I am still searching for info, but I am missing it
somehow. Does anyone know where I can find an example of this or a code
snippet? Thanks truckloads!
--- End Message ---
--- Begin Message ---
On 4/17/06, Jay Blanchard <[EMAIL PROTECTED]> wrote:
> I know that this is simple, and again I am operating on little rest in
> the quest to get a site launch by sometime tomorrow evening.
>
> I have a table of data and I want to display items by two's, i.e.
>
> Item 1 Item 2
> Item 3 Item 4
> Item 5
>
> ...and so on. I seem to remember doing this using mod to calculate if I
> had divided by 2. I am still searching for info, but I am missing it
> somehow. Does anyone know where I can find an example of this or a code
> snippet? Thanks truckloads!
Something like this?
$c = 0;
while($c < $itemcount) {
if ($c % 2 == 0) ....
$c++;
}
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
[snip]
Something like this?
$c = 0;
while($c < $itemcount) {
if ($c % 2 == 0) ....
$c++;
}
[/snip]
Yep! Thanks!
--- End Message ---
--- Begin Message ---
At 05:19 PM 4/16/2006, Jay Blanchard wrote:
I have a table of data and I want to display items by two's, i.e.
Item 1 Item 2
Item 3 Item 4
Item 5
Pardon my asking on the eve of your launch, but is a table the most
sensible markup for this data? It looks to me like a one-dimensional
list that just happens to be presented two to a row.
If so, I'd use an unordered list, float each item left, and limit the
list width to two item widths.
Regards,
Paul
--- End Message ---
--- Begin Message ---
[snip]
Pardon my asking on the eve of your launch, but is a table the most
sensible markup for this data? It looks to me like a one-dimensional
list that just happens to be presented two to a row.
If so, I'd use an unordered list, float each item left, and limit the
list width to two item widths.
[/snip]
Thanks, but I just used what I showed as an example. It is a table
products including pictures, features, etc.
--- End Message ---
--- Begin Message ---
I second that, and if anyone in the know cares to comment on whether:
a. php will actually implement static late binding
Mike Lively gives and update on the late static binding patch submitted
to the internals on his blog
http://www.digitalsandwich.com/archives/53-Late-Static-Binding-in-PHP.html
--
life is a game... so have fun.
--- End Message ---
--- Begin Message ---
1. I'm not the original poster (I wasn't asking a question)
2. don't post me or anyone else 'offlist' unless asked
3. WTF are you talking about?
4. if you say 'First' then that assumes there is a 'Second'
coming. (that's sounds kinda funny given it was just Easter)
suresh kumar wrote:
First,
If u want to search work "richard hassed" .first
split the word as "richard" and "hassed" by using
split() and store it in array.and use select like
command to search individual word stored in array.this
type of searching is followed in google.
A.suresh
--- Jochem Maas <[EMAIL PROTECTED]> wrote:
don't know if someone mentioned it already but i was
digging around in the docs
for something completely different and bumped into
this:
preg_grep() [http://php.net/preg_grep]
and I thought of your question, might be just what
your looking for.
I can't remember having come across this func before
- learn something new every day :-)
Ryan A wrote:
Hi,
Like the subject says; I have two questions:
1) Is it possible to detect JavaScript via php...
and yes I do know that JS
is client side while PHP is server...but how else
to do it?
The reason I ask is before serving an AJAX page I
would like to make sure JS
is enabled, if not, serve the other "normal
page"... I am sure I am not the
first person to come accross this little problem,
how did you solve it?
I have seen some suggestions on google like having
a hidden form field and
using js to put a value in it, if it exists when
the form is sent then JS
is on..if not, its not... but that method is not
the best in an AJAX
situation...right?
2) How can I search in an array for a particular
word?
eg: in an array "movie" I have this kind of data:
movie_name=> some movie
cast=> Jim Carrey, Richard Pryor, Eddie Murphy
I want to search on either "Richard" or "Richard
Pryor" (must be case
insensitive too)
something like a SELECT with a LIKE %% statement
I have been fooling around with in_array() but not
getting anywhere
fast..... am I on the right track?
Links, code examples or advise would be as
always....appreciated.
Thanks,
Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________________________________________________________
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com
--- End Message ---