vikela Posted March 10, 2009 Share Posted March 10, 2009 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 https://forums.phpfreaks.com/topic/148734-navigate-though-my-records-one-by-one/ Share on other sites More sharing options...
aschk Posted March 10, 2009 Share Posted March 10, 2009 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 https://forums.phpfreaks.com/topic/148734-navigate-though-my-records-one-by-one/#findComment-780986 Share on other sites More sharing options...
vikela Posted March 10, 2009 Author Share Posted March 10, 2009 thanks but my question is how can i go to the next dataset especially by having a button or link to click on my page.i would also like to insert into another table any of the dataset i have seen. Link to comment https://forums.phpfreaks.com/topic/148734-navigate-though-my-records-one-by-one/#findComment-780990 Share on other sites More sharing options...
aschk Posted March 10, 2009 Share Posted March 10, 2009 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 https://forums.phpfreaks.com/topic/148734-navigate-though-my-records-one-by-one/#findComment-780994 Share on other sites More sharing options...
vikela Posted March 10, 2009 Author Share Posted March 10, 2009 i am still lost?but will try hard Link to comment https://forums.phpfreaks.com/topic/148734-navigate-though-my-records-one-by-one/#findComment-781148 Share on other sites More sharing options...
aschk Posted March 10, 2009 Share Posted March 10, 2009 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 https://forums.phpfreaks.com/topic/148734-navigate-though-my-records-one-by-one/#findComment-781258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.