Link to home
Start Free TrialLog in
Avatar of jerrrrry
jerrrrry

asked on

please help me to convert old style php to something great to mysqli or PDO

$link = new mysqli("localhost","root","","portfolio");
if ($link->connect_errno)  die("Error " . $link->connect_errno );

$link->query("SET NAMES 'utf8'");


 
$id= $_GET['id'];
$query = "SELECT `id`, `$tl` as 'info' FROM image WHERE id ='$id'";
    $result = mysql_query($query) or die('Erreur de la requête infos : ' . $query);

while ($row = mysql_fetch_assoc($result)) {
echo $row["info"];

}

Open in new window

Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

$id= $_GET['id'];
$query = "SELECT `id`, `$tl` as 'info' FROM image WHERE id ='$id'";
$result = mysqli_query($conn,$query) or die(mysqli_error($conn));
while ($row = $result->fetch_assoc()) {
   echo $row['info'];
}
$result->free();

Open in new window

Cheers
Avatar of jerrrrry
jerrrrry

ASKER

ok i changed $conn to $link
then i have this warning Warning: mysql_fetch_assoc() expects parameter 1 to be resource, object given in C:\wamp\www\test-ajax2.php on line 18

?
thanks
ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
my apologize i made a mistake and let a part of the old script!
thanks