Wayne B Posted May 11, 2015 Posted May 11, 2015 HiOk so if I want to query a specific database in Pages to extract a result I have my SQL query as follows;$sql = "SELECT primary_id_field,field_34,field_35,field_36 FROM ipbcms_custom_database_10 ORDER BY primary_id_field DESC LIMIT 1"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<div align='center'><h3>Month: " . $row["field_34"]. "<br><br>Display Name: <font color='#FF0000'> " . $row["field_36"]. " </font><br><br>Reason: " . $row["field_35"]. "</h3></div><br><br>"; }The issue here is that field_36 is actually the member ID so it returns the ID and not the Display Name. How could i then query the members table to use the returned value in field_36 and then display the result as the display name?Members table is ipbcore_membersDisplay name table is nameAny help would be appreciated -
Dermot Posted May 12, 2015 Posted May 12, 2015 i would imagine it's not display name in that field, it's not even in the members table from what i can see, there is a seo name?something like.. $result = mysqli_query($conn,"SELECT * FROM members ORDER BY member_id DESC LIMIT 1"); while ($query = mysqli_fetch_assoc($result)) { echo "<img src='http://i.imgur.com/RBJ7w3r.png' width='16' height='16' /><a href ='profile.php?user=$query[name]'>$query[name]</a> <br />"; echo "<img src='http://i.imgur.com/RBJ7w3r.png' width='16' height='16' /><a href ='profile.php?user=$query[members_seo_name]'>$query[members_seo_name]</a> <br />"; }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.