I’m refactoring some code and found something I’ve never seen. the function is used for user to set cookie when user logs in: function setUserCookie($name, $value) { $date = date(“D, d M Y H:i:…
How can I disable the back browser button after user press logout and destroy session?
I am having trouble with session_destroy(). When the User press Log out it have to destroy the session. I wrote the following code: Logout.php After pressing log out, when I press the browser back button it is showing my previous Logined user page and session username in Login.php page Login.php LoginViewCont…
SELECT id FROM table_name WHERE column = $variable
I’m trying to retrieve the id number of a record to use as a variable elsewhere. I only want the id from a record that has a particular value in another column. here is my code: When I test I get: SQL syntax; check the manual that corresponds to your MySQL server versi0on for the right syntax to use nea…
MySQL ORDER BY Date field which is not in date format
I have a field containing dates in this format DD/MM/YYYY and I need to order the results DESC by this field, but it is saved as a VARCHAR and I cannot change this. Is there a workaround? There …
php for loop from array stops after 3 loops
I have an array that looks like this. I want to loop through array in the first key of [2] and echo all the values. this works, but stops after three loops and the output looks like this: I am expecting — hoping for this: I don’t understand why it is stopping. thanks. Answer Your problem lies here…
Codeigniter when i click delete i want pop up notification if if click yes or not
Model: function delete_exchange($ExchangeRateId) { $this -> db -> where(‘ExchangeRateId’, $ExchangeRateId); $this -> db -> delete(‘exchange_rate’); } Controller: function …
Detect user exit site
I have an urge to detect when a user leaves my site in order to record accurately the session length of the user in question. I have thought of a couple possible solutions for this: I first thought I could use onbeforeunload and send a simple ajax to record the last activity but what practice has shown me is …
MySQLi Query returning fatal errors for an unknown reason
So, I’v just finished coding the base for a very simple script I’m working on except it’s returning Fatal error: Call to a member function bind_param() on a non-object in C:wampwww…
Download tracks from Soundcloud via their API
I have around 1000 liked tracks on Soundcloud and I’d like to download the ones available for download. Is it possible to use the API to download these where a download option is available? Thanks …
Safely remove migration In Laravel
In Laravel, there appears to be a command for creating a migration, but not removing. Create migration command: If I want to delete the migration, can I just safely delete the corresponding migrations file within the database/migrations folder? Migrations file: Answer I accidentally created a migration with a…