Developers Archive for the 'php5 programming' Category

BLOB

BLOB Monday, February 19th, 2007

- BLOB is the short-term used for Binary Large OBject. Example for Binary Large OBject is JPEG image.
- We can insert the these BLOB type using the mysql query. The effient method for blob data is using mysqli_stmt_send_long_data() function.

Example:

$conn = mysqli_connect(”localhost”, “user”, “”, “db”);

$stmt = $conn->prepare(”INSERT INTO files VALUES(NULL, ?)”);
$stmt->bind_param(”s”, $data);
$file = “img.jpg”;
$fp = fopen($file, “r”);
$size = 0;

while ($data = fread($fp, 1024)) {
$size += strlen($data);
$stmt->send_long_data(0, $data);
}
stmt->execute();

In the above example, we have inserted img.jpg into the table.And bind_param function is used to bind variables to a prepared statement. And send_long_data function is used to send block of datas.

Final Methods in PHP5

Final Methods in PHP5 Friday, February 9th, 2007

The function declared as final can be used with in subclass but
like other function we cannot override the function declared as final.

<?php

class A {

final function print_all() {
echo ‘this is class A’;
}

}

class B extends A {

function print_all() {
echo ‘this is class B’;
}

}

$obj = new B();
$obj->print_all();

?>

Executing the above example results in the following error:

Fatal error: Cannot override final method A::print_all() in E:/work/test_final.php

Why visitors will return to your site

Why visitors will return to your site Wednesday, January 31st, 2007

According to a survey, here are the top reasons why visitors come back to your site:

1. Content (74%) - The main reason for a user to not visit your site again was most of the time “non-sense” or irrelivant content.

2. Enjoyability of the site (71%) - It was either something interesting in the layout or the interface that made them come back.

3. Organization of content (68%) - Users returned to sites that were well organized with a good layout & no text not all over the place.

4. Uniqueness of the site (66%) - Uniqueness is a big factor in sites, if it is something they’ve seen before, chances they won’t come back to your site.

5. Ease of access (64%) - The easier users can find content and information on your site, they more they returned to it.

6. Visually attractive (58%) - Good looking sites with effort put into the theme of the site had a reasonable amount of people come back.

7. Easy to navigate (54%) - This one is self-explaintory. Navigation should always be in a clear place, such as under the header or to the left side (mostly).

8. Website speed (53%) - Sure we all share this one, if a site is slow at loading, chances that we’ll never visit the site again because it’s “slow”.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.