Custom high performance search engine development contract or hire by Kevin Duraj Tel: (310) 774-948

Category Archives: PHP Development

PHP String (empty vs. NULL)

//— checking string for NULL —//
$string1 = NULL;
if(is_null($string1)) echo “string1 is NULL\n”;
else echo “string1 is not NULL\n”;
if($string1 === NULL) echo “string1 is NULL\n”;
//— checking string for EMPTY —//
$string2 = “”;
if(empty($string2)) echo “string2 is empty\n”;
else echo “string2 is not empty\n”;
string1 is NULL
string2 is empty

mysqli – MySQL Improved Extension

Reference: http://us3.php.net/mysqli

<?php
$db = new mysqli(“localhost”, “db_username”, “db_password”, “db_name”);

if (mysqli_connect_errno())
{
die(“Connect failed: ” . mysqli_connect_error());
}

// some relatively simple SQL
// …find all users whose names begin [...]