SQL Array PHPv5

I am currently working with a set of posted variables from a form in php5: $var1, $var2 and $var3. I need to search for them in SQL as an array, and return the results if any of the variables has been entered in in the php form.

I have found an example using PHP4 from a tutorial, but I need to create the same code in PHPv5. Here is the tutorial code:

[COLOR=“YellowGreen”]$searchSQL = $db->query("SELECT Title, Creator, Description FROM ICM WHERE ";

  // grab the search types.
  $types = array();
  $types[] = isset($_GET['var1'])?"`Title` = '$searchTermDB'":'';
  $types[] = isset($_GET['var2'])?"`Creator` = '$searchTermDB'":'';
  $types[] = isset($_GET['var3'])?"`Description` = '$searchTermDB'":'';
  $types = array_filter($types, "removeEmpty"); 
  if (count($types) < 1)
     $types[] = "`Description` = '$searchTermDB'";       
      $andOr = isset($_GET['matchall'])?'AND':'OR';
  $searchSQL .= implode(" {$andOr} ", $types) . " ORDER BY `Description`"); 
  $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}");[/COLOR]

I would like to know where I need to change this code in phpv5.
Many thanks in advance.

PHP 5 is (mostly) backwards compatible with PHP 4. You do not have to change any PHP4 code.

grand thanks :wink:

if it helps, here is the documentation on Migrating from PHP 4 to PHP 5 which includes some [url=“http://www.php.net/manual/en/migration5.incompatible.php”]Backward Incompatible Changes that you will hardly ever come up against.