digitalgod Posted August 12, 2008 Share Posted August 12, 2008 hey guys, I have a script where users can add/remove clients, my problem is that when a person clicks on delete, the page refreshes, the row gets deleted from the db but it still shows that client in the html table, the info will disappear only after a page refresh. I'm pretty sure it's a cache problem but I have no idea how to fix this.. any suggestions would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 12, 2008 Share Posted August 12, 2008 Post your code, it is likely it is doing something in the wrong order. Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 12, 2008 Share Posted August 12, 2008 I doubt its a cache problem. What i can think is that your update code is procedurally below the fetch code. Smth like this: query the db and show info ..... delete handler where it should be delete handler .... query the db and show info That way u update the db and then show the information. Hope this helped. Quote Link to comment Share on other sites More sharing options...
digitalgod Posted August 13, 2008 Author Share Posted August 13, 2008 hmm I see what you mean, makes perfect sense. here's what I've been doing $sql_clients = "SELECT * FROM client"; $result = mysql_query($sql_clients); $clients_count = mysql_num_rows($result); if( isset($_GET['a']) && isset($_GET['id'])) { $action = stripslashes(mysql_real_escape_string($_GET['a'])); if ( $action == "del" ) { $cid = stripslashes(mysql_real_escape_string($_GET['id'])); $sql_delete = "DELETE FROM client WHERE client_id = '$cid'"; $delete_result = mysql_query($sql_delete); $sql_delete2 = "DELETE FROM client_address WHERE client_id = '$cid'"; $delete_result2 = mysql_query($sql_delete2); } } so I guess I should just switch them around instead. edit works perfectly, thanks! Quote Link to comment 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.