Does anyone see anything wrong with this code?

jlknauff

New member
Aug 25, 2008
237
1
0
Does anyone see anything wrong with this code?

PHP:
<?php

    $mysqli = new mysqli("localhost", "db", "pw", "user");
    $query = "SELECT ID FROM wp_posts WHERE post_title = 'some post'";
        $id = mysqli_query($mysqli, $query);
    echo var_dump($id);

?>

It returns:

PHP:
object(mysqli_result)#2 (0) { }

In this case, the value in the DB is 993 and the field type is bigint
 


$mysqli = new mysqli("localhost", "db", "pw", "user");
$query = "SELECT ID FROM wp_posts WHERE post_title = 'some post'";
$result = mysqli_query($mysqli, $query);


$row = mysql_fetch_assoc($result);
$id = $row['ID'];
 
I see the code highlighting in this forum still need to be tweaked...aaaaaargh.

::emp::