Jump to content

navigate though my records one by one


vikela

Recommended Posts

i have created a query that retrieves records and show them in a textarea.now i want to be able to navigate to the next record like having a next button that will take me to the next record.i would like to be able to insert any record that i have read into a history table.

 <?php


include('Config.php');



$sql = "SELECT * FROM Email_Inb";// ORDER BY subject ASC";
$query = mysql_query($sql);
               if (!$query) { // Handle error
                  echo 'Query failed. SQL: ', $sql, '<br />Error # ', mysql_errno(), ' Error msg: ', mysql_error();
                  exit;
                  }
             

while($row=mysql_fetch_array($query)){

  $theFid=$row['member_id'];//member"
  $themsg=$row['emailmsg'];//message
  $thedate=$row['recdate'];//date received
  $theid=$row['main_id'];//id
  };
  ?>


<style type="text/css">
<!--
.style1 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
}
-->
</style><title>Inbound emails</title>
<div align="center"><strong><span class="style1"><u>Email Inbound </u></span></strong></div>
<form id="form1" name="form1" method="post" action="">
  <table width="1015" border="0" align="center">
    <tr>
      <th width="2" scope="col"> </th>
      <th width="467" scope="col">Mode:-
        <select name="select">
        <option value="email" name="email">Email</option>
        <option value="SMS">SMS</option>
        <option value="MMS">MMS</option>
            </select>      </th>
      <th width="532" scope="col"> </th>
    </tr>
    <tr>
      <td> </td>
      <td align="center"><strong>Sender:-</strong>
        <input name="sender" type="text" id="sender" value="<?php echo $theFid ?>"/></td>
      <td> </td>
    </tr>
    <tr>
      <td height="77" rowspan="2"> </td>
      <td align="left"><strong>Message:-</strong></td>
      <td><strong>Reply:-</strong></td>
    </tr>
    <tr>
      <td align="center"><textarea name="msg" cols="75" id="msg" value="frrf"><?php echo $themsg ?></textarea></td>
      <td align="center"><textarea name="respond" cols="75" id="textarea"></textarea></td>
    </tr>
    <tr>
      <td> </td>
      <td align="center"><input type="submit" name="Submit" value="   Post to web    " />
        <input type="submit" name="Submit2" value="   Delete   " />
        </td>
      <td><input name="reply" type="submit" id="reply" value="  Reply  " /></td>
    </tr>
    <tr>
      <td> </td>
      <td align="center"> </td>
      <td> </td>
    </tr>
  </table>
</form>

Link to comment
Share on other sites


while($row=mysql_fetch_array($query)){

  $theFid=$row['member_id'];//member"
  $themsg=$row['emailmsg'];//message
  $thedate=$row['recdate'];//date received
  $theid=$row['main_id'];//id
  };
  ?>

 

You are already looping through your dataset by using the while loop I have quoted above.

Link to comment
Share on other sites

I've given the hint ;)

With the code I quoted you're ALREADY looping your dataset, i.e. what you have there is getting the next row each time in a loop. You just need to figure out what you should really be putting inside the loop.

Link to comment
Share on other sites

I'll provide you with an example so you can see what I mean:

 

<?php


while($row=mysql_fetch_array($query)){

   echo $theFid=$row['member_id'];//member"
   echo $themsg=$row['emailmsg'];//message
   echo $thedate=$row['recdate'];//date received
   echo $theid=$row['main_id'];//id
  };

?>

 

Put that in your code and you'll see what I mean.

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.