Jump to content

vet911

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by vet911

  1. Here is the error code: Fatal error: Call to a member function query() on a non-object in <b>/home/content/r/i/g/rigtway/html/site_1.php on line 68
  2. I have included most of the code from the beginning. <?php try { { /*** mysql hostname ***/ $hostname = 'xxxxxxxxxxxxxxxxxxxxx'; /*** mysql username ***/ $username = 'xxxxxxxxxx'; /*** mysql password ***/ $password = 'xxxxxxxxx'; $dbname = 'xxxxxx'; $dhb = null; $dbh = new PDO("mysql:host=$hostname;dbname=$dbname", $username, $password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true ); /** echo a message saying we have connected **/ /**echo "connected"; **/ } } catch(PDOException $e) { echo $e->getMessage(); } ?> <div class="content"> <?php include('header.php');?> <?php include('menu1.php');?> <br /> <div> <center><table cellspacing="5" cellpadding="5" width="800" border="0"> <tr> <td height="57" colspan="3" width="800"> <hr /> <div style="text-align: center;">Multiuse Pictures 2014</div> <div style="text-align: center;">Click picture to enlarge.</div> <hr /> </td> </tr> <?php try { $type = $_GET['type']; //-query the database table if($_GET['type'] == 'ak') { //*$sql = "SELECT * FROM jewelry WHERE class = '$type' ";**/ $sql = "SELECT id, cid, group, image_th, image, picture, comment FROM images WHERE group = 'dionne' ORDER BY cid ASC"; } else if($_GET['type'] == 'dionne') { $sql = "SELECT * FROM images WHERE picture = '2'"; } $result = $dbh->query($sql); $rows2 = '0'; $rows3 = '0'; if($result) { $i = 0; $max_columns = 3; foreach ($result as $row) { // open row if counter is zero if($i == 0) { echo "<tr VALIGN='top'>"; } // if ($row['avail'] != "0") //{ // make sure we have a valid product ALIGN='CENTER' if($row['image_th'] != "" && $row['image_th'] != null) {
  3. I'm getting this error message after changing the $hostname given to me from Godaddy. It lists line 68 as the error: this is the code section $result = $dbh->query($sql); Any help would be appreciated. <?php try { $type = $_GET['type']; //-query the database table if($_GET['type'] == 'ak') { //*$sql = "SELECT * FROM jewelry WHERE class = '$type' ";**/ $sql = "SELECT id, cid, group, image_th, image, picture, comment FROM images WHERE group = 'dionne' ORDER BY cid ASC"; } else if($_GET['type'] == 'dionne') { $sql = "SELECT * FROM images WHERE picture = '2'"; } $result = $dbh->query($sql);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.