DHH on PHP

src: http://www.loudthinking.com/posts/23-the-immediacy-of-php

Even David Heinemeier Hansson himself talks about using PHP.

how to change phpmyadmin theme

I just don’t want the default theme that came in with PHPMyAdmin they are huge and my eyes hurt when I look at them. If you are like me that doesn’t want to take extra step to develop themes and just want to have it appear smaller then this procedure is for you.

Enjoy!

resetting the auto_increment field in mysql

Oftentimes one needs to test web application to see if it works. But during those times one doesn’t have to retain all of the test data and after you delete the test data the auto_increment field(mostly id’s) don’t reset itself.

Here is a way to reset the auto_increment column in your mysql database:

alter table account auto_increment=4;

Guessing that I have 3 accounts I wanted to retain.

find the next auto_increment number in mysql

Finding the next auto_increment is easy on phpmyadmin. Just select your database from the left side dropdown box. Then select the table on the lower part of it. Then click structure.

But what if it’s in mysql? or in PHP?
In PHP:

<?
$tablename         = “tablename”;
$next_increment     = 0;
$qShowStatus         = “SHOW TABLE STATUS LIKE ‘$tablename’”;
$qShowStatusResult     = mysql_query($qShowStatus) or die ( “Query failed: ” . mysql_error() . “<br/>” . $qShowStatus );

$row = mysql_fetch_assoc($qShowStatusResult);
$next_increment = $row['Auto_increment'];

echo “next increment number: [$next_increment]“;
?>

source: http://blog.jamiedoris.com/geek/560/

In MySQL prompt:

SHOW TABLE STATUS LIKE ‘tablename’;