Jump to content

Woody777

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Woody777

  1. But I have and check connection: // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
  2. I have done something with pdo but that is on my sale and rent page: include 'database.php'; $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM properties inner join images on images.propertyid = properties.propertyid WHERE Status ='For Sale' group by images.propertyid"; foreach ($pdo->query($sql) as $row) { $propertyid = $row['PropertyId']; $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql1 = "SELECT * FROM images where PropertyId = ?"; $q1 = $pdo->prepare($sql1); $q1->execute(array($propertyid)); $data = $q1->fetch(PDO::FETCH_ASSOC); echo '<li class="col-md-4">'; echo '<div class="proj_block">'; echo '<img alt="" style="opacity: 1" src="'. $row['ImageUrl'].'"></div>'; echo '<div class="proj_descr"><h2>'. $row['Title'] . '</h2>'; echo '<div class="proj_descr_txt">'.'<b>Location: </b> '. $row['Location'] . '</div>'; echo '<div class="proj_descr_txt">'.'<b>Bed: </b> '. $row['Bedrooms'] . '</div>'; echo '<div class="proj_descr_txt">'.'<b>Bath: </b> '. $row['Bathrooms'] . '</div>'; echo '<div class="proj_descr_txt">'.'<b>Parking: </b> '. $row['Parking'] . '</div>'; echo '<div class="proj_descr_txt">'.'<b>Price: </b>R'. $row['Price'] . '</div>'; echo '<a href="readmore.php?PropertyId='.$propertyid.'">Read More</a>'; echo '</li>'; } Database::disconnect();
  3. Ok well thank you for the advice. As soon as I put the code at the end I get that error. Do you maybe have any other suggestions?
  4. O yes and there is another thing I am getting a error: What does it mean? Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\sa property finder\search.php on line 268
  5. Ok I see but can't I just add it to that query?
  6. Hi I have this Query and would like to get help on this. I have a table with Price in it and on my search form I have Min Price and Max Price, I want to connect the min and max price to price so that when people do a search ith will display the results between the min and max price they chose, for instants: Min Price = 1000 and Max Price = 10000 it have to give me that results between that 1000 and 10000. $query = "SELECT distinct Img.propertyId as PropertyId, Title, ImageUrl, Location, Bedrooms, Bathrooms, Parking, Price FROM PROPERTIES as Prop LEFT JOIN IMAGES as Img ON Img.PropertyId = Prop.PropertyId WHERE 1=1 "; Thank you
×
×
  • 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.