Hi,
When I want to delete an ad it works and deletes it from the database but it still shows in my php page. But if I refresh the page it is also deleted from the php page. How can I solve this ?
Thank you !
Hi,
When I want to delete an ad it works and deletes it from the database but it still shows in my php page. But if I refresh the page it is also deleted from the php page. How can I solve this ?
Thank you !
I’m not quite sure I understand.
You load ads from your database, then you delete the ad from the database…
So at this point it should still be on the page…
Then when you refresh the page, it’s gone (Which is correct)
I’m guessing you mean, that after you delete the page, it loads the image from cache on the client browser. You can force the client to not load a page from cache by changing the meta tags…
[php][/php]
This will tell the client browser to not cache any data.
It works when I execute the same query twice. One for each while loop(one loop for checking which button has been pressed and one loop for displaying the ads) as you can see in my code:
[php]<?php
ini_set(‘display_errors’,1);
error_reporting(E_ALL);
define(“DBASE”,“sqlite:…/sqlite/Polderlaan_Db.sqlite”);
$style = ‘…/.common/default.css’;
$table = ‘AanbodSpul’;
try {
$db = new PDO(DBASE);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
die();
}
function Delete($id) {
global $db, $table;
$test = $db->query(“DELETE FROM $table WHERE id = $id”);
if($test) echo “ID: $id deleted”;
if (is_file("…/fotoos/$id.jpg"))
unlink("…/fotoos/$id.jpg");
}
?>
Test
<?
}
?>
|
Is it normal having to execute the query twice ??
I already solved it with the help of another forum !!