james19
06-18-2008, 08:05 AM
Hi
Ive found a code from the internet which does not work, I think the problem is that I have PHP4 and the code is written in PHP5, does anyone know how to change the code to PHP4??? Can anyone give me a good website which explains the difference in coding in php4 and 5??? The code is shown below:
<?php
$db = new mysqli(‘localhost’, ‘root’ ,”, ‘password’);
if(!$db) {
echo ‘ERROR: Could not connect to the database.’;
} else {
if(isset($_POST[‘queryString’])) {
$queryString = $_POST[‘queryString’];
if(strlen($queryString) >0) {
$query = $db->query("SELECT value FROM something WHERE value LIKE ‘$queryString%’ LIMIT 10");
if($query) {
while ($result = $query ->fetch_object()) {
echo ‘<li onclick="fill(’‘.$result->value.’‘);">’.$result->value.‘</li>’;
}
} else {
echo ‘ERROR: There was a problem with the query.’;
}
} else {
}
} else {
echo ‘There should be no direct access to this script!’;
}
}
?>
Your help would be very much appreciated.
Thanks:)
Ive found a code from the internet which does not work, I think the problem is that I have PHP4 and the code is written in PHP5, does anyone know how to change the code to PHP4??? Can anyone give me a good website which explains the difference in coding in php4 and 5??? The code is shown below:
<?php
$db = new mysqli(‘localhost’, ‘root’ ,”, ‘password’);
if(!$db) {
echo ‘ERROR: Could not connect to the database.’;
} else {
if(isset($_POST[‘queryString’])) {
$queryString = $_POST[‘queryString’];
if(strlen($queryString) >0) {
$query = $db->query("SELECT value FROM something WHERE value LIKE ‘$queryString%’ LIMIT 10");
if($query) {
while ($result = $query ->fetch_object()) {
echo ‘<li onclick="fill(’‘.$result->value.’‘);">’.$result->value.‘</li>’;
}
} else {
echo ‘ERROR: There was a problem with the query.’;
}
} else {
}
} else {
echo ‘There should be no direct access to this script!’;
}
}
?>
Your help would be very much appreciated.
Thanks:)