Archive for February, 2009

SET SQL_BIG_SELECTS=1

Thursday, February 26th, 2009 by dreamluverz




I encountered this error on my query. I had the same query on my local computer, running without any problem but uploading it on the live site I got this error below:

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay ….

According to some source it depends on the settings of the mysql, so my guess is my hosting provider set the limit of it, so in order to solve this on my site I followed the suggestion on the error msg.

So you can do it like this. Before executing your query execute this first
Example: mysql_query(‘SET SQL_BIG_SELECTS=1′) OR mysql_query(’set SQL_MAX_JOIN_SIZE={NUMBER}’);
I used the 1st one and it works for me!

list alphabet using php

Monday, February 16th, 2009 by dreamluverz




I was looking for ways on how to list the alphabet without manually writing each one of them…
I guess I found an answer here http://xqus.com/printing-alphabet-php.

There were actually different methods being suggested. One that came from the author is by using range(). It can also be used with numbers.

range

(PHP 4, PHP 5)

range — Create an array containing a range of elements

Sample below:

Letters

<?php
foreach(range('a', 'z') as $letter) {
    echo $letter;
}
?>

Numbers

<?php
foreach(range(0, 12) as $number) {
    echo $number;
}
?>

<?php
foreach(range(0, 100, 10) as $number) {
    echo $number;
}

And some suggested these:
array_walk(range('a', 'z'), "printf");
For UPPERCASE: for($i=65; $i<91; $i++) { echo chr($i); }

For lowercase: for($i=97; $i<123; $i++) { echo chr($i); }

I haven’t tried any methods yet but I guess I’ll be trying out range() instead :)

Free sitemap generator

Monday, February 16th, 2009 by dreamluverz

Are you looking for a free sitemap generator? Try using
http://www.sitemapbuilder.org/ it’s fast and easy. Just type in the site’s URL and you’re good to go :) Enjoy!!!

codec for windows media player 11

Friday, February 13th, 2009 by dreamluverz

Are you having trouble playing movies esp .avi format on windows media player 11?  We got the same problem. Hahaha. :D But don’t worry  after some digging on the internet I found out that I should install divx, you can get it here => http://www.divx.com/en/downloads/divx and problem solved. I am now smiling and enjoying the movie :)

mysql_data_seek to reset mysql recordset in php

Friday, February 13th, 2009 by dreamluverz

I’ve been into this situation where I need to reset the recordset for mysql and one way to do this is by using mysql_data_seek().

Sample below from mysql site:

Description

bool mysql_data_seek ( resource result, int row_number )

mysql_data_seek() moves the internal row pointer of the MySQL result associated with the specified result identifier to point to the specified row number. The next call to a MySQL fetch function, such as mysql_fetch_assoc(), would return that row.

row_number starts at 0. The row_number should be a value in the range from 0 to mysql_num_rows() – 1. However if the result set is empty (mysql_num_rows() == 0), a seek to 0 will fail with a E_WARNING and mysql_data_seek() will return FALSE.

Parameters

result
The result resource that is being evaluated. This result comes from a call to mysql_query().

row_number
The desired row number of the new result pointer.

Return Values

Returns TRUE on success or FALSE on failure.

<?php
$link
= mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!
$link) {
die(
'Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('sample_db');
if (!
$db_selected) {
die(
'Could not select database: ' . mysql_error());
}
$query = 'SELECT last_name, first_name FROM friends';
$result = mysql_query($query);
if (!
$result) {
die(
'Query failed: ' . mysql_error());
}
/* fetch rows in reverse order */
for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
if (!
mysql_data_seek($result, $i)) {
echo
"Cannot seek to row $i: " . mysql_error() . "\n";
continue;
}

if (!($row = mysql_fetch_assoc($result))) {
continue;
}

echo $row['last_name'] . ' ' . $row['first_name'] . "<br />\n";
}

mysql_free_result($result);
?>

Notes

Note: The function mysql_data_seek() can be used in conjunction only with mysql_query(), not with mysql_unbuffered_query().

for photoshop fonts only

Tuesday, February 10th, 2009 by dreamluverz

In some cases we would like to use the fonts we installed for photoshop for photoshop purposes only and we don’t want it to load in other applications.

In order to do that install your photoshop fonts in this location:
C:\Program Files\Common Files\Adobe\Fonts

And there you go, no need to worry seeing them anywhere else.

Oh btw, I heard that if you got hundreds of these fonts installed on that location C:\Program Files\Common Files\Adobe\Fonts it will take time for your photoshop to load, anyway I haven’t tried it yet :P , so I can’t really verify :) .

Or accdg to some source you can also install it here: control panel => fonts or  c:\windows\fonts

Well I haven’t checked the difference between the two locations w/ regards to photoshop performance. It’s up to you to find out and tell me :)