sandbudd Posted July 8, 2008 Share Posted July 8, 2008 <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.htm"); } ?> <table width="37%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="103"> </td> <td colspan="2"> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> </tr> <tr> <td><a href="logout.php">Log Out</a></td> <td width="164"><a href="changepass.php">Change Password</a></td> <td width="313"><a href="retrieve.php">RFQ Submitted Information</a></td> </tr> </table> <?php $db_host = ''; $db_user = ''; $db_pwd = ''; $database = ''; $table = ''; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); //Retrieves data from MySQL $data = mysql_query("SELECT * FROM ae_gallery") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { echo "<table align=\"center\" border=1 bordercolordark=\"#777777\" width=\"60% \" bordercolorlight=\"#dddddd\" bgcolor=\"BBBBBB\">"; //Outputs the image and other data Echo "<tr><td width=\"50%\"><font size=\"3\" color=red>Name:</font> ".$info['customer'] . "</td> "; Echo "<td><font size=\"3\" color=red>Company:</font> ".$info['company'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Address:</font> ".$info['address'] . " </td>"; Echo "<td><font size=\"3\" color=red>City:</font> ".$info['city'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>State:</font> ".$info['state'] . " </td>"; Echo "<td><font size=\"3\" color=red>Zip:</font> ".$info['zip_code'] . " </td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>Email:</font> ".$info['email'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Phone:</font> ".$info['phone'] . " </td>"; Echo "<td><font size=\"3\" color=red>Fax:</font> ".$info['fax'] . " </td></tr>"; echo "<tr><td colspan=\"2\"><font size=\"2\" color=blue>Process Requested</font></tr></td>"; Echo "<tr><td><font size=\"3\" color=red>Type II:</font> ".$info['type2'] . " </td>"; Echo "<td><font size=\"3\" color=red>Type III:</font> ".$info['type3'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Burnish:</font> ".$info['burnish'] . " </td>"; Echo "<td><font size=\"3\" color=red>Chromate:</font> ".$info['chromate'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Chromate Hex Free:</font> ".$info['hex'] . " </td>"; Echo "<td><font size=\"3\" color=red>Impregnation:</font> ".$info['impregnation'] . " </td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>Strip:</font> ".$info['strip'] . " </td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>Part Number:</font> ".$info['part'] . " </td>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>Part Description:</font> ".$info['description'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Alloy:</font> ".$info['alloy'] . " </td>"; Echo "<td><font size=\"3\" color=red>Quantity:</font> ".$info['quantity'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Specifications:</font> ".$info['spec'] . " </td>"; Echo "<td><font size=\"3\" color=red>Color:</font> ".$info['color'] . " </td></tr>"; echo "<tr><td colspan=\"2\"><font size=\"2\" color=blue>How Did You Hear About Us?</font></td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Repeat Customer:</font> ".$info['repeat_customer'] . " </td>"; Echo "<td><font size=\"3\" color=red>Internet Search:</font> ".$info['isearch'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Internet Directory:</font> ".$info['internet_directory'] . " </td>"; Echo "<td><font size=\"3\" color=red>Referral:</font> ".$info['referral'] . " </td></tr>"; Echo "<tr><td><font size=\"3\" color=red>Yellow Pages:</font> ".$info['yellow_pages'] . " </td>"; Echo "<td><font size=\"3\" color=red>Trade Show:</font> ".$info['trade'] . " </td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>Other:</font> ".$info['other'] . " </td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>Notes:</font> ".$info['notes'] . " </td></tr>"; Echo "<tr><td colspan=\"2\"></td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red>File:</font><a href=upload/".$info['image1'] ."> ".$info['image1'] . " </a>"; Echo "<a href=upload/".$info['image2'] ."> ".$info['image2'] . " </a>"; Echo "<a href=upload/".$info['image3'] ."> ".$info['image3'] . " </a>"; Echo "<a href=upload/".$info['image4'] ."> ".$info['image4'] . " </a>"; Echo "<a href=upload/".$info['image5'] ."> ".$info['image5'] . " </a>"; Echo "<a href=upload/".$info['image6'] ."> ".$info['image6'] . " </a>"; Echo "<a href=upload/".$info['image7'] ."> ".$info['image7'] . " </a>"; Echo "<a href=upload/".$info['image8'] ."> ".$info['image8'] . " </a>"; Echo "<a href=upload/".$info['image9'] ."> ".$info['image9'] . " </a>"; Echo "<a href=upload/".$info['image10'] ."> ".$info['image10'] . " </a>"; Echo "<a href=upload/".$info['image11'] ."> ".$info['image11'] . " </a>"; Echo "<a href=upload/".$info['image12'] ."> ".$info['image12'] . " </a>"; Echo "<a href=upload/".$info['image13'] ."> ".$info['image13'] . " </a>"; Echo "<a href=upload/".$info['image14'] ."> ".$info['image14'] . " </a>"; Echo "<a href=upload/".$info['image15'] ."> ".$info['image15'] . " </a>"; Echo "<a href=upload/".$info['image16'] ."> ".$info['image16'] . " </a>"; Echo "<a href=upload/".$info['image17'] ."> ".$info['image17'] . " </a>"; Echo "<a href=upload/".$info['image18'] ."> ".$info['image18'] . " </a>"; Echo "<a href=upload/".$info['image19'] ."> ".$info['image19'] . " </a>"; Echo "<a href=upload/".$info['image20'] ."> ".$info['image20'] . " </a></td></tr>"; Echo "<tr><td colspan=\"2\"><font size=\"3\" color=red></font><a href='retrieve.php?id=".$info['id']."'>delete</a></td></tr><br><br>"; } if(isset($_GET['id'])) { $query = "DELETE FROM ae_gallery WHERE id=".$_GET['id']." LIMIT 1"; mysql_query($query) or die("Could not delete the entry!"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/ Share on other sites More sharing options...
wildteen88 Posted July 8, 2008 Share Posted July 8, 2008 Don't just paste code. Provide more information in your post, such as what you're trying to. What the script is supposed to do, and the outcome after running it. If you have any errors, always post them in full. Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584808 Share on other sites More sharing options...
sandbudd Posted July 8, 2008 Author Share Posted July 8, 2008 sorry about that....the code does work but when I click the delete button to have a id deleted from the database I have to click it twice? Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584810 Share on other sites More sharing options...
.josh Posted July 8, 2008 Share Posted July 8, 2008 My first guess is that you have your delete condition after your info dump so it's getting deleted on first click but your info dump isn't being updated until next page request. Test it out by instead of clicking the delete a 2nd time, click your refresh button, or go look in your phpmyadmin or w/e after the first click. Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584815 Share on other sites More sharing options...
sandbudd Posted July 9, 2008 Author Share Posted July 9, 2008 your right if I refresh it is gone...how do I fix so I dont have to refresh? Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584952 Share on other sites More sharing options...
TransmogriBenno Posted July 9, 2008 Share Posted July 9, 2008 Move this if(isset($_GET['id'])) { $query = "DELETE FROM ae_gallery WHERE id=".$_GET['id']." LIMIT 1"; mysql_query($query) or die("Could not delete the entry!"); } before the SELECT query is executed, for obvious reasons. Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584957 Share on other sites More sharing options...
.josh Posted July 9, 2008 Share Posted July 9, 2008 put the condition and query that deletes it before your stuff that queries the info and displays it. Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584958 Share on other sites More sharing options...
sandbudd Posted July 9, 2008 Author Share Posted July 9, 2008 Im an idiot.. I tried to put it in several places and get errors...could you tell me exactly where to insert it please. Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584966 Share on other sites More sharing options...
.josh Posted July 9, 2008 Share Posted July 9, 2008 what error messages? only thing i can think of offhand is maybe you put it before your code that connects to your db? seriously, it's really hard to help when you're being so vague. Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584983 Share on other sites More sharing options...
sandbudd Posted July 9, 2008 Author Share Posted July 9, 2008 thanks for the reply but I am not getting an error message I am having to double click or refresh the page for the delete to work Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-584984 Share on other sites More sharing options...
.josh Posted July 9, 2008 Share Posted July 9, 2008 well I see you marked it as solved so I'm going to assume you figured out what order to put it in? Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-585487 Share on other sites More sharing options...
sandbudd Posted July 9, 2008 Author Share Posted July 9, 2008 yes I did and Thank you for the help Quote Link to comment https://forums.phpfreaks.com/topic/113786-solved-having-to-double-click-delete/#findComment-585571 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.