Jump to content

vet911

Members
  • Posts

    100
  • Joined

  • Last visited

Posts posted by vet911

  1. Thanks for the comment. I finally figured it out.

    try {
    echo "<br>";
    foreach($dbh->query("SELECT * FROM test_shot WHERE testshot=1 ORDER BY year ASC") as $row) {
    							
    			echo "<div class='image-holder'><img src ='".$row['picture']."' width=300px /><br><a> ".$row['year']."  ".$row['description']."	</a>";
                          
                if($row['sold'] == 1) {
    			echo "<img src='images/sold1.png'></div>";
    			}
    			elseif ($row['sold'] == 0) {							
    			echo "</div>";
    			}
    		}
    	}	
    
    catch (PDOException $e) {
      print $e->getMessage();
    }

     

  2. try {
    echo "<br>";
    foreach($dbh->query("SELECT * FROM test_shot WHERE sold=1 ORDER BY year ASC") as $row) {
    	
    						if($row['picture'] != "" && $row['picture'] != null)
    						{
    						echo "<div class='image-holder'><img src ='".$row['picture']."' width=300px /><br>";  
                			}
    						if($row['year'] != "" && $row['year'] != null)
    						{
    							echo $row['year'];
    						}
    						if($row['description'] != "" && $row['description'] != null)
    						{
    							echo $row['description'];
    						}
    						if($row['sold'] == 1) {
    							echo "<img src='images/sold1.png'><br>";//Add your image code here
    							}
    							elseif ($row['sold'] == 0) {
    							
    							echo "</div><br>";
    						}
    					}
    
    	}	
    
    catch (PDOException $e) {
      print $e->getMessage();
    }
    
    ?>

     

  3. $result = $dbh->query($sql);
    
    			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'] != "" && $row['image'] != null)
    					{
    						echo "<td><div class=box><a href=$row[image] rel=lightbox title=$row[image]><img class=border src=$row[image]>";  
                						
    						if($row['itemno'] != "" && $row['itemno'] != null)
    						{
    							echo "<a>Item No: </a>$row[itemno]<br />";
    						}
    						if($row['description'] != "" && $row['description'] != null)
    						{
    							echo "<a>Description: </a>$row[description]<br /> ";
    						}
    						//if($row['sold'] !=1)
    							//{
                                       if($row['price'] != "" && $row['price'] != null)
    						           {
    						             echo "<a>Price: $</a>$row[price]<br />";
    									 
    									
    									echo "<form target='paypal' action='' method='post'>";
    									echo "<input type='hidden' name='cmd' value='_cart'>";
    									echo "<input type='hidden' name='add' value='1'>";
    									echo "<input type='hidden' name='business' value=''>";
    									echo "<input type='hidden' name='item_name' value='$row[description]'>";
    									echo "<input type='hidden' name='item_number' value='$row[itemno]'>";
    									echo "<input type='hidden' name='amount' value='$row[price]'>";
    									echo "<input type='hidden' name='shipping' value='7.00'>";
    									echo "<input type='hidden' name='shipping2' value='0.50'>";
    									echo "<input type='hidden' name='handling' value='2.00'>";
    									echo "<input type='hidden' name='currency_code' value='USD'>";
    									echo "<input type='hidden' name='return' value=''>";
    									echo "<input type='hidden' name='undefined_quantity' value='1'>";
    									echo "<input type='image' src='' height='21' border='0' name='submit'  alt=''>";
    									echo "</form>";
    									
    									
    						           }                                                                                                                
                                
                                       //else($row['sold'] !=0)
                                            //{
                                            //echo "<img src='images/sold.png'>";                                                  
    										//}
    								//}
    						
    						
                                 //echo "</form>";
    					}
    				
               
                     
    						echo "</div></td>";
    				//	}
    					// increment counter - if counter = max columns, reset counter and close row
    					if(++$i == $max_columns)
    					{
    						echo "</tr>";
    						$i=0;
    					}	// end if
    				} // end while
    			} // end if results
          
         
    			
    			// clean up table - makes your code valid!
    			if($i < $max_columns)
    			{
    				for($j=$i; $j<$max_columns;$j++)
    				{
    					echo "<td>&nbsp;</td>";
    				}
    			}
    		}

    My website shows items listed from the database with a picture and associated information including a icon to make the purchase. I want to show the item as sold after the purchase and not the hidden info that is sent to aPayapl to make the purchase. I would like show the item as sold and attach a sold icon but eliminate the paypal hidden info. I tried but when I run the program it breaks. I tried to comment out the stuff i tried. I need some help please. Thanks in advance for any help.

  4. I have to say you are the man. I have looked at that sense this morning when I made the post about being lost. I can honestly say I did not see those dollar signs.

    I appreciate all your help. Something else has been in my thoughts, I have a sign up page and after you login it brings you to a form which is blank. I want people to be able to change their own stuff. If they did it right the would have to fill out, name address, city, state, phone before they cold save that page without filling in the rest of the form.

    What I'm thinking, is there a way to see if they filled out the partial required form and if so it will load that info and they would be able to fill in the rest or update it at a later time?

    Thanks for your help. 

  5. Ok so this is what I have now. 

    <?php 
    	try
    {
    	{
    		/*** mysql hostname ***/
    		$hostname = 'localhost';
    
    		/*** mysql username ***/
    		$username = 'xxxx';
    
    		/*** mysql password ***/
    		$password = '';
    
    		$dbname = 'dblogin';
    
    		$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";
    
    		$get_id=$_REQUEST['id'];
    		
    
    $registerStmt = $dbh->prepare('
        UPDATE register
        SET
    		fname = :fname,
                    lname = :lname,
    		address = :address, 
    		city = :city, 
    		state = :state, 
    		zip = :zip, 
    		phone = :phone,
    		large = :large, 
    		lsize = :lsize, 
    		lmatl = :lmatl, 
    		medium = :medium, 
    		msize = :msize, 
    		mmatl = :mmatl, 
    		small = :small, 
    		ssize = :ssize, 
    		smatl = :smatl,
    		desc1 = :$desc1, 
    		desc2 = :$desc2, 
    		desc3 = :$desc3 
        WHERE
            id = :id
    	');
    	
    
    
    $registerStmt->execute([
    	'fname' => $_POST['fname'],
            'lname' => $_POST['lname'],
    	'address' => $_POST['address'],
    	'city' => $_POST['city'],
    	'state' => $_POST['state'],
    	'zip' => $_POST['zip'],
    	'phone' => $_POST['phone'],
    	'large' => $_POST['large'],
    	'lsize' => $_POST['lsize'],
    	'lmatl' => $_POST['lmatl'],
    	'medium' => $_POST['medium'],
    	'msize' => $_POST['msize'],
    	'mmatl' => $_POST['mmatl'],
    	'small' => $_POST['small'],
    	'ssize' => $_POST['ssize'],
    	'smatl' => $_POST['smatl'],
    	'desc1' => $_POST['desc1'],
    	'desc2' => $_POST['desc2'],
    	'desc3' => $_POST['desc3'],
    	'id' => $get_id,
        ]);
    
        
    	}
    }
    catch(PDOException $e)
    {
    	echo $e->getMessage();
    }
    ?>
    

    And this is the error message.

    SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
    

    I counted all the variables and tokens and I think they match, so am I wrong?

  6. This is the error I'm getting.
    
    Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxx', desc2 ='xx', desc3 ='x' WHERE id = '1'' at line 15' in 
    

    This is my code:

    require_once('connect.php');
    
    $get_id=$_REQUEST['id'];
    
    $fname = $_POST['fname'];
    $lname = $_POST['lname'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $phone = $_POST['phone'];
    $large = $_POST['large'];
    $lsize = $_POST['lsize'];
    $lmatl = $_POST['lmatl'];
    $medium = $_POST['medium'];
    $msize = $_POST['msize'];
    $mmatl = $_POST['mmatl'];
    $small = $_POST['small'];
    $ssize = $_POST['ssize'];
    $smatl = $_POST['smatl'];
    $desc1 = $_POST['desc1'];
    $desc2 = $_POST['desc2'];
    $desc3 = $_POST['desc3'];
    
    $sql = "UPDATE register SET 
    fname ='$fname',
    lname ='$lname', 
    address ='$address', 
    city ='$city', 
    state ='$state', 
    zip ='$zip', 
    phone ='$phone',
    large ='$large', 
    lsize ='$lsize', 
    lmatl ='$lmatl', 
    medium ='$medium', 
    msize ='$msize', 
    mmatl ='$mmatl', 
    small ='$small, 
    ssize ='$ssize', 
    smatl ='$smatl',
    desc1 ='$desc1', 
    desc2 ='$desc2', 
    desc3 ='$desc3' 
    WHERE id = '$get_id' ";
    
    
    $dbh->exec($sql);
    
    

    If you could give me some direction to figure this out it would be appreciated. 

    Thanks in advance for your time.

  7. Hi, I found out the problem, the error was generating and shown at the bottom of the page. I have sense figured out that the password was incorrect. I changed that and now it works. I want to correct the script so it's not supplying directly to the database as mentioned in the reply from "benanamen" but not sure how to do that. Do I have to remove the script from the form page and have the form call the script to insert the data to the database?

    I have done this before but not recently. Any help would be appreciated. Thanks to all who replied.

  8. I have enclosed all the form below, this worked fine on localhost that's why I was surprised it didn't work.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
    <script type="text/javascript" src="jquery-1.11.3-jquery.min.js"></script>
    <link rel="stylesheet" href="style.css" type="text/css"  />
    <link rel="stylesheet" href="style_test.css" type="text/css"  />
    <title></title>
    </head>
    
    <body>
    
    <nav class="navbar navbar-default navbar-fixed-top">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
              <ul class="nav navbar-nav">
                <li class="active"><a href="http://www.php">About</a></li>
                <li><a href="http://guidelines.php">Guidelines</a></li>
                <!--<li><a href="http://home.php">Back</a></li> -->
    	  </ul>
              <ul class="nav navbar-nav navbar-right">
                <li><a href="logout.php?logout=true"><span class="glyphicon glyphicon-log-out"></span> Log Out</a></li>
              </ul>
            </div><!--/.nav-collapse -->
          </div>
        </nav>
    
    
        <div class="clearfix"></div>
        	
        
    <!-- <div class="container-fluid" style="margin-top:80px;"> 
    	
    <div class="container"> -->
    
    <div class="container-fluid text-center" style="margin-top:80px;">
        
      <div class="row content">
        <div class="col-sm-3 sidenav">
          
        </div>
        <div class="col-sm-6 text-left">
            <!--<div> -->
    		<h2>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</h2>
    		<div id="fillout">
    		<h2>Please fill out form.</h2>
    		<hr/>
    		<form action="" method="post">
    		<label>First Name:</label>
    		<input type="text" name="fname" id="fname" required="required" placeholder="First Name"/><br /><br />
    		<label>Last Name:</label>
    		<input type="text" name="lname" id="email" required="required"  placeholder="Last Name"/><br/><br />
    		<label>Address:</label>
    		<input type="text" name="address" id="address" required="required"  placeholder="Address"/><br/><br />
    		<label>City:</label>
    		<input type="text" name="city" id="address" required="required"  placeholder="City"/><br/><br />
    		<label>State:</label>
    		<input type="text" name="state" id="state" required="required"  placeholder="State"/><br/><br />
    		<label>Zip Code:</label>
    		<input type="text" name="zip" id="zip" required="required"  placeholder="Zip Code"/><br/><br />
    		<label>Phone:</label>
    		<input type="text" name="phone" id="phone" required="required"  placeholder="603-111-2222"/><br/><br />
    		<label>Large:</label>
    		<input type="text" name="large" id="large" placeholder="21mm & up"/><br/><br />
    		<label>Cut:</label>
    		<input type="text" name="lsize" id="lsize" placeholder="Hexagon"/><br/><br />
    		<label>Material:</label>
    		<input type="text" name="lmatl" id="lmatl" placeholder="Aquamarine"/><br/><br />
    		<label>Medium:</label>
    		<input type="text" name="medium" id="medium" placeholder="11mm - 20mm"/><br/><br />
    		<label>Cut:</label>
    		<input type="text" name="msize" id="msize" placeholder="Round"/><br/><br />
    		<label>Material:</label>
    		<input type="text" name="mmatl" id="mmatl" placeholder="Smokey Quartz"/><br/><br />
    		<label>Small:</label>
    		<input type="text" name="small" id="small" placeholder="1mm - 10mm"/><br/><br />
    		<label>Cut:</label>
    		<input type="text" name="ssize" id="ssize" placeholder="Trillion"/><br/><br />
    		<label>Material:</label>
    		<input type="text" name="smatl" id="smatl" placeholder="Peridot"/><br/><br />
    		<label>Cab or Carving 1:</label>
    		<input type="text" name="desc1" id="desc1" placeholder="Description 1"/><br/><br />
    		<label>Cab or Carving 2:</label>
    		<input type="text" name="desc2" id="desc2" placeholder="Description 2"/><br/><br />
    		<label>Cab or Carving 3:</label>
    		<input type="text" name="desc3" id="desc3" placeholder="Description 3"/><br/><br />
    
    		<input type="submit" value=" Save Form " name="submit"/><br />
    </form>
    </div>
    		<!--</form>-->   
       <!-- </div> -->
        <div class="col-sm-3 sidenav">
          
        </div>
      </div>
    </div>
    		
    <script src="bootstrap/js/bootstrap.min.js"></script>
    
    <?php
    error_reporting(E_ALL);
            ini_set('display_errors', '1');
    		
    if(isset($_POST["submit"])){
    $hostname='XXXX';
    $username='XXXX16';
    $password='XXXX16';
    
    try {
        $dbh = new PDO("mysql:host=$hostname;dbname=dblogin",$username,$password);
    
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // <== add this line
     
    $sql = "INSERT INTO register (fname, lname, address, city, state, zip, phone, large, lsize, lmatl, medium, msize, mmatl, small, ssize, smatl, desc1, desc2, desc3)
    VALUES ('".$_POST["fname"]."','".$_POST["lname"]."','".$_POST["address"]."','".$_POST["city"]."','".$_POST["state"]."','".$_POST["zip"]."','".$_POST["phone"]."','".$_POST["large"]."','".$_POST["lsize"]."','".$_POST["lmatl"]."','".$_POST["medium"]."','".$_POST["msize"]."','".$_POST["mmatl"]."','".$_POST["small"]."','".$_POST["ssize"]."','".$_POST["smatl"]."','".$_POST["desc1"]."','".$_POST["desc2"]."','".$_POST["desc3"]."')";
    
    
    if ($dbh->query($sql)) {
         echo "<script type= 'text/javascript'>alert('New Record Inserted Successfully');</script>";
    } 
    else{
         echo "<script type= 'text/javascript'>alert('Data not successfully Inserted.');</script>";
    }
    
        $dbh = null;
        }
    catch(PDOException $e)
        {
        echo $e->getMessage();
        }
    
    }
    ?>
    
    </body>
    </html>
    
  9. I'm having trouble sending data to database, nothing apprear in table and no error messages. Below is the file I'm using.

    <?php
    error_reporting(E_ALL);
            ini_set('display_errors', '1');
    		
    if(isset($_POST["submit"])){
    $hostname='xxxxxx';
    $username='xxxxxx';
    $password='xxxx';
    
    try {
        $dbh = new PDO("mysql:host=$hostname;dbname=dblogin",$username,$password);
    
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // <== add this line
     
    $sql = "INSERT INTO register (fname, lname, address, city, state, zip, phone, large, lsize, lmatl, medium, msize, mmatl, small, ssize, smatl, desc1, desc2, desc3)
    VALUES ('".$_POST["fname"]."','".$_POST["lname"]."','".$_POST["address"]."','".$_POST["city"]."','".$_POST["state"]."','".$_POST["zip"]."','".$_POST["phone"]."','".$_POST["large"]."','".$_POST["lsize"]."','".$_POST["lmatl"]."','".$_POST["medium"]."','".$_POST["msize"]."','".$_POST["mmatl"]."','".$_POST["small"]."','".$_POST["ssize"]."','".$_POST["smatl"]."','".$_POST["desc1"]."','".$_POST["desc2"]."','".$_POST["desc3"]."')";
    
    
    if ($dbh->query($sql)) {
         echo "<script type= 'text/javascript'>alert('New Record Inserted Successfully');</script>";
    } 
    else{
         echo "<script type= 'text/javascript'>alert('Data not successfully Inserted.');</script>";
    }
    
        $dbh = null;
        }
    catch(PDOException $e)
        {
        echo $e->getMessage();
        }
    
    }
    ?>
    
  10. $getid = $_POST['id'];
    	$getitemno = $_POST['itemno'];
    	$getavailability = $_POST['availability'];
    		
    // Connect to server and select database.
    	try
    	{
    	echo "$getitemno";
        // UPDATE data
    	$sql = "UPDATE cut_stones 
    			SET 
    			itemno= :itemno, 
    			availability= :availability
    			WHERE id= :id";
        $stmt = $dbh->prepare($sql);
    	$stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT);	
    	$stmt->bindParam(':itemno', $_POST['itemno'], PDO::PARAM_STR);    
    	$stmt->bindParam(':availability', $_POST['availability'], PDO::PARAM_INT);	
    	$stmt->execute(); 
        
    	}
    	catch(PDOException $e)
    	{
    		echo $e->getMessage();
    	}
    // if successfully updated.
    $dhb = null;
    	 
    	 echo "       Updated";
    

    I figured it out. I have listed the code above.

    Thanks for the help.

  11. I updated the code, I don't get any error message. But when I look at the database it doesn't change availability to (0).

    Still lost.

    try
    	{
    	echo "$getitemno";
        // UPDATE data
    	$sql = "UPDATE cut_stones 
    			SET 
    			itemno= :itemno, 
    			availability= :availability
    			WHERE id= :id";
        $stmt = $dbh->prepare($sql);
    	$stmt->bindParam(':id', $_POST['$id'], PDO::PARAM_INT);	
    	$stmt->bindParam(':itemno', $_POST['$itemno'], PDO::PARAM_STR);    
    	$stmt->bindParam(':availability', $_POST['availability'], PDO::PARAM_INT);	
    	$stmt->execute(); 
        
    	}
    	catch(PDOException $e)
    	{
    		echo $e->getMessage();
    	}
    // if successfully updated.
    $dhb = null;
    	 
    	 echo "       Updated";
    	 
    ?>
    
  12. 
    
    I'm trying to update the itemno specified from available (1) to (0). I'm getting this error message and can't seem to figure it out. I must be missing something really easy. Any help would be appreciated.

     

    This is the error message: 

    connected

    tv-jw10-976

    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id='78'' at line 5

    Updated

    $getid = $_POST['id'];
    $getitemno = $_POST['itemno'];
    $getavailability = $_POST['availability'];
    try 
    { echo "$getitemno";
     // UPDATE data 
    $sql = "UPDATE cut_stones SET itemno= :itemno, availability= :availability, WHERE id='$getid'";
    $stmt = $dbh->prepare($sql);
    $stmt->bindParam(':itemno', $_POST['$itemno'], PDO::PARAM_STR);
    $stmt->bindParam(':availability', $_POST['availability'], PDO::PARAM_INT);
    $stmt->execute(); 
    } 
    catch(PDOException $e) 
    { 
    echo $e->getMessage();
    }
    // if successfully updated. 
    $dhb = null; 
    echo " Updated";
    ?>
  13. post-94675-0-41376200-1451243996_thumb.jpg

    post-94675-0-63761600-1451243770_thumb.jpg

     

    Thanks for the reply. I only want (1) label. the way I want it shown is in the pictures shown.(original1.jpg is from the original file posted. (array.jpg is what I am getting from the array) 

    I don't know how to get all the data into the array. Help would be appreciated. No sure if the pictures will show up, the original posted were png file and they didnt show.

    The label  "Gypsum City OHRV Park, ort Dodge, IA 2015" is for all the pictures below it.

  14.  

     

     

     

    Thanks for the reply Muddy_Funster. I finally got a chance to work on this problem. I tried to incorporate your multidimensional array. Had some luck, had some failure.

    I got it to work but it only shows item 14 in the browser when I run it. In the original form I was getting all picture to show. My objective was to make a file to show all picture in the database listed under the label. I have enclosed pictures of the displays(array.png shows current working on model.)(original.png shows before array work.  I appreciate you help. Looking for guidense to further this. My question is why don't I get all the data in the array I get it in the original sql statement as shown in the original picutre?

    <?php
    		try
    		{
    		  $type = $_GET['type'];
          
          if($_GET['type'] == 'dionne')
    				{
    					
              $sql = "SELECT 
    					groups.list,
    					groups.title as label,
    					images.image_th,
    					images.image,
    					images.list_images,
    					images.cid, images.comment
    					FROM groups
    					INNER JOIN images
    					ON images.list_images=groups.list
    					WHERE list='dionne' ORDER BY cid ASC";
    				}    
                     
    			$result = $dbh->query($sql);
    			
    			$custResArray = array();
    			
    			foreach($result as $row){
    					$custResArray[$row['label']] = array('list_images'=>$row['list_images'],
    					'image_th'=>$row['image_th'],
    					'image'=>$row['image'],
    					'cid'=>$row['cid'],
    					'comment'=>$row['comment']);				
    			}			
    			if($result)
    			{				
    				// print_r($result);
    				$i = 0;
    				$max_columns = 3;
    				
    				foreach($custResArray as $lbl=>$items){
    				echo "<hr />";
    				echo "<div style='text-align: center;'>$lbl</div>";
    				echo "<div style='text-align: center;'>Click picture to enlarge.</div>";
    				echo "<hr />";
    				
    				foreach ($items as $cid=>$item)
    				{ // while beginning
    					// open row if counter is zero
    					if($i == 0)
    					{
    						echo "<tr VALIGN='top'>";						
    					}          
    					if($row['image_th'] != "" && $row['image_th'] != null)
    					{
    						echo "<td><div><a href=$row[image] onclick='return hs.expand(this)' id='thumb1' class='highslide' title=$row[cid]><img src=$row[image_th] width=250></a> <div class='highslide-caption'>$row[comment]</div>";  
    						echo " ";						
    						if($row['cid'] != "" && $row['cid'] != null)
    						{
    							echo "<center><a>Item:</a>$row[cid]<br />";                         
    						}
    						}
    						echo "</div></td>";				
    					// increment counter - if counter = max columns, reset counter and close row
    					if(++$i == $max_columns)
    					{
    						echo "</tr>";
    						$i=0;
    					}	// end if
    				} // end while
    			} // end if results
                		
    			if($i < $max_columns)
    			{
    				for($j=$i; $j<$max_columns;$j++)
    				{
    					echo "<td> </td>";
    				}
    			}
    		}
    		}
    		catch(PDOException $e)
    		{
    			echo $e->getMessage();
    		}
    		$dhb = null;
    ?>    
    
  15. <?php
    		try
    		{
    		  $type = $_GET['type'];
          
          if($_GET['type'] == 'ia')
    				{
    					
              $sql = "SELECT 
    			groups.list,   
                            groups.title as label, 
                            images.image_th, 
                            images.image, 
                            images.cid, 
                            images.comment
    			FROM groups
    			INNER JOIN images
    			ON images.list_images=groups.list
    			WHERE list='ia' ORDER BY cid ASC";
    				}
            
                     
    			$result = $dbh->query($sql);
    						
    			if($result)
    						
    			{
    				echo "<td height='60' colspan='3' width='800'>";
    						echo "<hr />";
    						echo "<div style='text-align: center;'><?php echo ['label']; ?></div>";
    						echo "<div style='text-align: center;'>Click picture to enlarge.</div>";
    						echo "<hr />";
    						echo "</td>";
    				// print_r($result);
    				$i = 0;
    				$max_columns = 3;
    				foreach ($result as $row)
    				{
    					// open row if counter is zero
    					if($i == 0)
    					{
    						echo "<tr VALIGN='top'>";
    						
    					}
              
    					// make sure we have a valid product ALIGN='CENTER'
    
    					if($row['image_th'] != "" && $row['image_th'] != null)
    					{
    						echo "<td><div><a href=$row[image] onclick='return hs.expand(this)' id='thumb1' class='highslide' title=$row[cid]><img src=$row[image_th] width=250></a> <div class='highslide-caption'>$row[comment]</div>";  
                echo " ";						
    						if($row['cid'] != "" && $row['cid'] != null)
    						{
    							echo "<center><a>Item:</a>$row[cid]<br />";
                                
    						}
    						}
                
                     
    	
    
    			echo "</div></td>";
    				
    					// increment counter - if counter = max columns, reset counter and close row
    					if(++$i == $max_columns)
    					{
    						echo "</tr>";
    						$i=0;
    					}	// end if
    				} // end while
    			} // end if results
          
          		
    			if($i < $max_columns)
    			{
    				for($j=$i; $j<$max_columns;$j++)
    				{
    					echo "<td> </td>";
    				}
    			}
    		}
    		catch(PDOException $e)
    		{
    			echo $e->getMessage();
    		}
    		$dhb = null;
    ?>
    

    I have tried several times, but can't figure it out as of yet. Some help would be appreciated.

  16. Okay I took it to heart. I have figured it out. It works fine but the text is a little to far from the image. Not sure how to fix that. I tried using padding but didn't seem to work. Any help?

    <style>
    .image-holder
    	{
      float:left;
      margin:5px;
      text-align: center;
      padding:10px 10px 0px 10px;
      color:#000; 
    }
    
    </style>
    
         <div class="image-holder">
         <img src="images/69astro_red.png" alt="" />
         <p>1969 Astro Red Convertible</p>
         </div>
         <div class="image-holder">
         <img src="images/69my.png" alt="" />
         <p>1969 Daytona Yellow </p>
         </div>
         <div class="image-holder">
         <img src="images/69dyellow.png" alt="" />
         <p>1969 Dark Yellow #W995</p>
         </div>
         <div class="image-holder">
         <img src="images/69red_no_head_1.png" alt="" />
         <p>1969 Red Convertible w/no headrest</p>
         </div>
    
×
×
  • 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.