Jump to content

Recommended Posts

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);

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)
					{
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.