0
Good Afternoon,
I am creating a script that will add cookies to the user account. The problem is... I want to add several cookies for example:
If the user clicks add to the advertisement 1 it will create a cookie with the ID 1. In 2h, if the user clicks on the advertisement 10 he will add 1 more cookie, thus leaving 2 cookies. ID 1 and ID 10.
I created it that way:
if(isset($_GET['add_favorite'])) {
$favorite_id = mysqli_real_escape_string($con, sanitize($_GET['add_favorite']));
setcookie("fav_ads_ids", $favorite_id, time() + (86400 * 30), "/");
}
The problem is that it simply does a cookie UPDATE, and that’s not what I want. I want to create viarias cookies for various ads in favorite with the same name "fav_ads_ids".
now we just need to configure the search in sql to generate the values for the cookie
– Willian
but that’s not quite it, is that I do not want to add soon the ID 1 or 2, will depend on the user. If I come an ad with ID ex: 3, I add in the correct favorites. Hours later I see another one with different ID and I add favorites... understand? The user will not choose 2 ID next. This is a Bookmark System
– RuiAlvez
Cookie Content: %7B%221%22%3A%22215%22%2C%222%22%3A%22215%22%7D ?
– RuiAlvez
humm blz pera ai that I will redo then, because this and the base... I will edit for you
– Willian
pq and the following if you have nothing ready the first thing you have to do and measure how many ads you have in db, then if it has none of a random?
– Willian
yes this, is exactly isos
– RuiAlvez
Warning: Trim() expects Parameter 1 to be string, Object Given in D: xampp htdocs Superfacil_v1.3.7 inc functions.php on line 1038
– RuiAlvez
@Ruialvez Eae solved?
– Willian
not...I think I need a tutorial on how to make Favorite System :S difficult
– RuiAlvez
@Ruialvez put the page there full I’ll give you a hand there you study her
– Willian
@Ruialvez your way of how to search in mysql
– Willian