Skip to content

Instantly share code, notes, and snippets.

@vvikramjhu
Created February 15, 2014 00:55
Show Gist options
  • Save vvikramjhu/9012722 to your computer and use it in GitHub Desktop.
Save vvikramjhu/9012722 to your computer and use it in GitHub Desktop.
<?php
echo $vendorSql;
if ($debug) {
echo "</br>term and value </br>";
echo $term, $value[1]. '</br>';
}
$stmt->bind_param('s', $term );
/* Error : PHP Fatal error: Call to a member function bind_param() on a non-object in
* /media/Yojimbo/gdrives/varun.vikram@airius*/safeview_www/www/search_indexPage.php on line 90
*/
SELECT cpe_vendor, cpe_product, count(cpe_vendor) as vendorCount FROM nvd_cpe WHERE cpe_vendor LIKE ? GROUP BY cpe_vendor, cpe_product ORDER BY cpe_product
term and value
%Supermicro%-1
@wrossmann
Copy link

The code would roughly be:

$dbh = new mysqli();
if( ! $stmt = prepare($query) ) {
    echo $dbh->error();
} else {
    $stmt->bind();
    $stmt->execute();
}

Although I tend towards:

$dbh = new mysqli();
if( ! $stmt = prepare($query) ) {
    throw new Exception($dbh->error());
}
$stmt->bind();
$stmt->execute();

So that my code does't expand out to crazy indent levels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment