May 30, 2008
It’s frustrating when PHP compilation errors are not shown during development. To make such compilation errors visible on the web pages, add this line in .htaccess:
php_value display_errors 1
Alternatively, if access to .htaccess is not allowed, this PHP code achieves the same result too:
ini_set(’display_errors’,1);
No Comments » |
php |
Permalink
Posted by singchyun
May 17, 2007
When running PEAR manager to install a package (eg, ./pear install Log), if you encounter this error “No handlers for package.xml version 2.0″, it means your PEAR needs upgrading.
The command to upgrade PEAR:
./pear upgrade PEAR
When upgrading PEAR, you might be prompted to upgrade some other dependencies (such as Archive_Tar):
./pear upgrade Archive_Tar
No Comments » |
php |
Permalink
Posted by singchyun
May 7, 2007
<?
$link = mysql_connect(’localhost’, ‘root’, ‘password’);
if (!$link) {
die(’Could not connect: ‘ . mysql_error());
}
$db_selected = mysql_select_db(’jsfbasic’, $link);
$result = mysql_query(’SELECT * FROM recipe’, $link);
if (!$result) {
die(’Invalid query: ‘ . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
echo $row[0] . ‘<br />’;
}
mysql_close($link);
?>
No Comments » |
mysql, php |
Permalink
Posted by singchyun
May 6, 2007
To retrieve the last inserted ID of the auto_increment column:
mysql> select last_insert_id();
The PHP equivalent is:
mysql_insert_id
The above must be invoked from the same thread that performed the insertion.
No Comments » |
mysql, php |
Permalink
Posted by singchyun