justlukeyou Posted August 14, 2013 Share Posted August 14, 2013 (edited) 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 August 14, 2013 by justlukeyou Quote Link to comment https://forums.phpfreaks.com/topic/281179-echo-mysqli-inside-html-join-function/ Share on other sites More sharing options...
requinix Posted August 14, 2013 Share Posted August 14, 2013 Have you tried, I dunno, copy and pasting the code into that spot? Quote Link to comment https://forums.phpfreaks.com/topic/281179-echo-mysqli-inside-html-join-function/#findComment-1445078 Share on other sites More sharing options...
justlukeyou Posted August 14, 2013 Author Share Posted August 14, 2013 Oh right, Its alot messier than MySQL. Quote Link to comment https://forums.phpfreaks.com/topic/281179-echo-mysqli-inside-html-join-function/#findComment-1445084 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.