Jump to content

JackW

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JackW

  • Rank
    Member

Contact Methods

  • Website URL
    http://www.panhandleyardsale.com/

Profile Information

  • Gender
    Not Telling
  1. You got me. The code is not for questions it is messages then the second table will be for comments. For each message there may be numerous (comments) replies. Tables below. table messages message_ID int 6 school var 10 name var 60 post_day var 50 reply_day var 50 message Med_Txt subject var 240 table replies reply_ID int 6 name var 60 message_ID var 20 reply_day var 50 message Med_Txt
  2. Duh! I have looked there and cannot understand what I am reading.
  3. I have a MySQL data base with two tables. (questions then answers?) I need to query the second table to find related results from a query on the first table. Here is what I have, How do I get it to combine the two queries? <?php $db = @mysqli_connect('localhost', 'unsabook', 'Password', 'unsabook'); if (!$db) { echo "Error: " . mysqli_connect_error(); exit(); } $rs_message = $db->query ("SELECT * FROM `messages` ORDER BY `message_ID` ASC LIMIT 0,200"); while ( $message_array = $rs_message->fetch_assoc() ) { echo '<div class="left10">'; echo $message_array['message_ID']; echo ' &nbsp; '; echo $message_array['name']; echo ' &nbsp; '; echo $message_array['subject']; echo ' <br>'; echo $message_array['message']; $message_ID = $message_array['message_ID']; echo '</div>'; } // 2nd table is below $rs_replies = $db->query ("SELECT * FROM `replies` WHERE `message_ID` = '".$message_ID."' ORDER BY `reply_ID` DESC"); while($reply_array = mysqli_fetch_assoc($rs_replies)) { echo '<div class="left10">'; echo $reply_array['reply_ID']; echo ' &nbsp; '; echo $reply_array['name']; echo ' &nbsp; '; echo $reply_array['message_ID']; echo ' &nbsp; '; echo $reply_array['reply_day']; echo ' &nbsp; '; echo $reply_array['message']; echo '</div>'; } $db->close(); ?>
×
×
  • 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.