Jump to content

Echo MySQLi Inside HTML (Join Function)


justlukeyou

Recommended Posts

Hi,

 

I have by means of complete fluke managed to build a MySQLi join query. However I cant figure out how to echo the results inside HTML.

 

I have echoed $long_name and $name here:

 

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}


$room = mysql_real_escape_string($_GET['room']);

echo $room; 

$query = "SELECT long_name, name
									FROM furniture_groups a
									INNER JOIN productdbase b
									ON a.id = b.product_id
									WHERE `room` = '$room'  LIMIT 15
									";	 	 
								
					if ($result = $mysqli->query($query)) {
					
 while ($row = $result->fetch_assoc()) {
        printf ("%s (%s)\n", $row["long_name"], $row["name"]);
    	


    ?>
But I would like to echo it here inside the HTML.

 

<div class="productrangeborder">
<div class="productsdetailsborder">
<a href="http://domain.co.uk/products/product/<?php echo $query_row['long_name']; ?>" class='productlink' rel="nofollow" ><?php echo $query_row['name']; ?>
</a>
</div>

</div></div>

<?php

}
}

?>
Edited by justlukeyou
Link to comment
Share on other sites

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.