Zepo. Posted October 5, 2007 Share Posted October 5, 2007 Ok i have a loop going on with a post in each one but im not sure how to take data from the loop into the posted page. Help would be greatly apprreciated. Heres the code. $match=mysql_query("SELECT id,posted,ladder,mid,wid,lid,refs,details FROM matchreports"); while(list($ids,$posted,$ladder,$mid,$wid,$lid,$refs,$details)=mysql_fetch_row($match)){ $account++; $refs = str_replace ('>', ''', $refs); $details = str_replace ('>', ''', $details); echo" <tr valign='top'> <form method='post'> <td class='optiontitle' colspan='2'><div>ID: $ids | Posted By: $posted | Ladder: $ladder | Match ID: $mid | Losser ID: $lid | Referees Present : $refs </div></td> </tr> <tbody id='tbody_keywords'> <tr valign='top'> <td class='alt1'><div class='smallfont' align='center'> $details </td><td class='alt1' width='5%' align='center'> <input type='hidden' name='act' value='deleterefticket'> <input type='image' src='./images/delete.png' name='submit'> </form></td> </tr> "; } Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/ Share on other sites More sharing options...
teng84 Posted October 5, 2007 Share Posted October 5, 2007 http://w3schools.com/php/php_mysql_select.asp Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363001 Share on other sites More sharing options...
Gibbs Posted October 5, 2007 Share Posted October 5, 2007 Your trying to loop a query to output multiple results? Why not use: $q = mysql_query(your query); while ($r = mysql_fetch_array($q)) { // Do this } Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363003 Share on other sites More sharing options...
Zepo. Posted October 5, 2007 Author Share Posted October 5, 2007 So then $r would be the prefix? like $r[id] or $r[posted]? I know i can change it just wondering how thatd work.. Also that would loop it right? Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363007 Share on other sites More sharing options...
teng84 Posted October 5, 2007 Share Posted October 5, 2007 i suggest read the link i gave you that will answer your questions Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363012 Share on other sites More sharing options...
Zepo. Posted October 5, 2007 Author Share Posted October 5, 2007 Got it thank you very much Gibbs. Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363016 Share on other sites More sharing options...
Zepo. Posted October 5, 2007 Author Share Posted October 5, 2007 Sorry for the double post, but its still not sending the data. $matches = mysql_query("SELECT id,posted,ladder,mid,wid,lid,refs,details FROM matchreports"); while ($match = mysql_fetch_array($matches)){ $account++; $refs = str_replace ('>', ''', $refs); $details = str_replace ('>', ''', $details); echo" <tr valign='top'> <form method='post'> <td class='optiontitle' colspan='2'><div>ID: $match[id] | Posted By: $match[posted] | Ladder: $match[ladder] | Match ID: $match[mid] | Losser ID: $match[lid] | Referees Present : $match[refs] </div></td> </tr> <tbody id='tbody_keywords'> <tr valign='top'> <td class='alt1'><div class='smallfont' align='center'> $match[details] </td><td class='alt1' width='5%' align='center'> <input type='hidden' name='act' value='deleterefticket'> <input type='image' src='./images/delete.png' name='submit'> </form></td> </tr> "; } Goes to function reportdelete($match){ global $config; mysql_query("DELETE FROM `matchreports` WHERE `id`='$match[id]'"); echo" <body style='margin:0px'> <div style='margin:10px'> <br /> <form method='post'> <table cellpadding='4' cellspacing='0' border='0' align='center' width='95%' class='tborder' id='optionsform'> <colgroup span='2'> <col style='width:45%'></col> <col style='width:55%'></col> </colgroup> <tr> <td class='tcat' align='center' colspan='2'> <b>Report Manager</b> </td> </tr> <tr valign='top'> <td class='optiontitle' colspan='2'><div>Deleted</div></td> </tr> <tbody id='tbody_keywords'> <tr valign='top'> <td class='alt1'><div class='smallfont' align='center'> Deleted report ID: $match[id], Originally posted by $match[posted]. </td> </tr> </tbody> </table>"; $adminlog[admin]="{$_SESSION['name']}"; $adminlog[details]="[Deleted Report]: ID: $match[id] Posted By: $match[posted]"; adminlog($adminlog); } Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363019 Share on other sites More sharing options...
Zepo. Posted October 6, 2007 Author Share Posted October 6, 2007 And this if you need it case "deleterefticket": include("./includes/refticket.php"); reportdelete($match); break; Quote Link to comment https://forums.phpfreaks.com/topic/72039-solved-quaries-posting-and-more-ohh-my/#findComment-363036 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.