Jump to content

usman07

Members
  • Posts

    310
  • Joined

  • Last visited

    Never

Posts posted by usman07

  1. I have a image and I want the image to be inline with the image beside it, iv tried most things but i cant get it to work. The other image beside the filter image are outputted using php.

     

    You can have a look here: http://mumtazproperties.hostei.com/forsale.php

     

    Heres the css that I have used for the filter image:

    
    #filter{
    width: 214px;
    height: 217px;
    padding-left: 8px;
    display: inline-table;
    }
    

     

    heres the css used for the image that are outputted by php:

    .propimage{
    width: 758px;
    height: 191px;
    padding-left: 15px;
    padding-top: 30px;
    display: inline-table;
    
    }
    

     

    Thank you

  2. It works mate, thats brilliant! thanks so much. 1 last thing, I want the images to be links just like they was in my other page Iv added it in the echo, is it somehow wrong? Thanks.

    echo "<a href='{$row['url']}'><img class='image1' src='{$row['images2']}' alt='' /></a><br />";
    

  3. Yeah mate, sorry here is the php code:

    
    <?php
    $host = ""; 
    //MySQL Database user name.
    $login = "";
    //Password for MySQL.
    $dbpass = "";
    //MySQL Database name.
    $db = "";
    
    //Make connection to DB
    try {
    $dbh = new PDO("mysql:host=mysql10.000webhost.com;dbname=$db", $login, $dbpass);
    } catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
    }
    
    //Make query.  Adjust table/field names as needed.
    //Basic query for properies for sale	
    $sql= "SELECT p.id, c.image_path FROM property as p ";
    $sql .= "LEFT JOIN catagorys AS c ";
    $sql .= "ON ";
    $sql .= "(c.property_id = p.id) ";
    $sql .= "WHERE p.market_type='sale'";	
    //Make array of filter allowed types
    $types=array("detached","semi-detached","terraced","flats");
    
    //Check for GET and if allowed type  
    if(isset($_GET['housetype']) && in_array($_GET['housetype'], $types)){
    //Add filter type to our query
    $sql .="p.housetype='{$_GET['housetype']}'";
    }
    //Add order by
    $sql .=" ORDER BY p.id";
    //execute query
    $result = $dbh->query($sql);
    //get result count
    $resultcount = $result->rowCount();
    //check count for no results
    if ($resultcount < 1){
    echo '<div class="error">Sorry, No Results Match Your Search.</div>';
    }
    while($row = $result->fetch(PDO::FETCH_BOTH)){
    echo '<div class="container" style="float:left;">';
    echo '<div class="imageholder" style="float:left;">';
    echo "<a href='{$row['url']}'><img class='image1' src='{$row['image_path']}' alt='{$row['summary']}' /></a> <br />";
    echo '</div>';
    echo '<div class="textholder" style="font-family:helvetica; font-size:14px; float:left; padding-top:10px;">';
    echo "{$row['summary']}";
    echo "<span style=\"color:#63be21;\"><br><br><b>{$row['bedrooms']} bedroom(s) {$row['bathrooms']} bathroom(s) {$row['receptions']} reception room(s)</b></span>";
    if($row['parking'] != null){
    echo "<span style=\"color:#63be21;\"><b> {$row['parking']} parking space(s)</b></span>";
    echo '<div class="sline"><img src="cutouts/search/sline.png" alt=""/></div>';
    }
    
    echo '</div>';
    echo '<div style="clear:both"></div>';
    }
    ?>
    

  4. Hello Drummin, Basically what I want is for the search filter to check information from the properties table for and check the ID's to see what type of property it is e.g. detached, semi detached etc, then output an image from that? I don't need any other fields, like the bedroom bathrooms etc and all of them.

  5. I get this error?

     

    Fatal error: Call to a member function rowCount() on a non-object in /home/a2221438/public_html/forsale.php on line 102

     

    This is line 102:

    $result = $dbh->query($sql);
    

     

    and below this is the row count:

    
    $resultcount = $result->rowCount();
    //check count for no results
    if ($resultcount < 1){
    

  6. I was just looking back at the insert.php page, and that doesn't have a $sql= "SELECT * FROM property WHERE market_type='Sale'"; so it doesnt select from a certain table, so if we just removed that, would that make any sense? I have absolutely no clue to what i'm saying is right or wrong.

     

    or how about using something like this:

    
    $qry = $sql->sqlStart.$sql->stmt.'Group By property.id';
    $results = mysql_query($qry) or die (mysql_error()."<br />|-|-|-|-|-|-|-|-|-|-|-|-<br />$qry");
    

  7. Yeah I know, does seem strange. here what i get when adding print_r($row);

     

    Array ( [id] => 2 [0] => 2 [location_id] => 4 [1] => 4 [catagory_id] => 1 [2] => 1 [type] => House [3] => House [bedrooms] => 3 [4] => 3 [bathrooms] => 1 [5] => 1 [receptions] => 2 [6] => 2 [parking] => 4 [7] => 4 [garden] => [8] => [market_type] => Sale [9] => Sale [asking_price] => 365,000 [10] => 365,000 [pay_interval] => [11] => [summary] => Situated in Oakwood this superb three bedroom semi-detached property that simply must be viewed to be appreciated. An early inspection is most strongly recommended and in brief will reveal, front entrance porch, reception hall, utility room and a stylish living room. [12] => Situated in Oakwood this superb three bedroom semi-detached property that simply must be viewed to be appreciated. An early inspection is most strongly recommended and in brief will reveal, front entrance porch, reception hall, utility room and a stylish living room. [full_description] => [13] => => property 2.html [14] => property 2.html )

     

  8. This is what i have so far:

    
    <?php
              require_once 'mstr_ref.php'; 
              $sql = new makeQuery();
              $sql->manAdd('market_type', 'sale');
              $types=array("detached","semi-detached","terraced","flats");  
              if(isset($_GET['type']) && in_array($_GET['type'], $types)){
              $sql->manAdd('type', "{$_GET['type']}");
              }
    
              $qry = $sql->sqlStart.$sql->stmt.'Group By property.id';
              $results = mysql_query($qry) or die (mysql_error()."<br />|-|-|-|-|-|-|-|-|-|-|-|-<br />$qry");
              if(mysql_num_rows($results) < 1){
              die ('<div class="error">Sorry, No Results Match Your Search.</div>');
              }
              while($row = mysql_fetch_assoc($results)){
              echo '<div class="container" style="float:left;">';
              echo '<div class="imageholder" style="float:left;">';
              echo "<a href='{$row['url']}'><img class='image1' src='{$row['image_path']}' alt='{$row['summary']}' /></a> <br />";
              echo '</div>';
              echo '<div class="textholder" style="font-family:helvetica; font-size:14px; float:left; padding-top:10px;">';
              echo "{$row['summary']}";
              echo "<span style=\"color:#63be21;\"><br><br><b>{$row['bedrooms']} bedroom(s) {$row['bathrooms']} bathroom(s) {$row['receptions']} reception room(s)</b></span>";
              if($row['parking'] != null){
              echo "<span style=\"color:#63be21;\"><b> {$row['parking']} parking space(s)</b></span>";
              echo '<div class="sline"><img src="cutouts/search/sline.png" alt=""/></div>';
              }
    
              echo '</div>';
              echo '<div style="clear:both"></div>';
              }
              ?>
    

     

    But I need some help on how to set up my database?

  9. Basically I have a property page where I want users to be able to click 'detached' and then only detached properties will appear, if the user click 'semi-detached' then only semi-detched properties will appear. but these properties that I want to appear are just images, then a link to the actually property page with all the details.

     

    You can view the page here to get a better understanding: http://www.mumtazproperties.hostei.com/forsale.html

     

    At the moment all of the properties appear on the page. (and when you select the filters it actually does what I want it too, but through HTML) But I want the information to come from a database and then use PHP code to execute it all.

     

    Help is hugely appreciated, thanks.

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