Jump to content

[SOLVED] cache problem


digitalgod

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

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.