Posts by J0K3R • 121 points
14 posts
-
-1
votes4
answers201
viewsA: Simplify IF instructions in PHP
Every comparison requires an IF | ELSEIF | SWITCH | $ ? (ternary operator). You can summarize your comparisons into variables, so that the IF does not get too extensive, example: $8pontos = ($d1 ==…
-
0
votes2
answers165
viewsA: Remove session when logging in
Select the record by login field. Compare if the sc_session field equals session_id() If not equal, delete the previously selected record or update with the current data…
-
-1
votes3
answers436
viewsA: Event Routine - PHP
You can do this with a cron task. If you are using a cPanel hosting, the following link will guide you with ease: http://wiki.locaweb.com.br/pt-br/Tarefas_Cron_-_Painel_cPanel…
-
0
votes3
answers3386
viewsA: Check if there is a character inside a text
Answering directly, as the title of your question: if ($_POST['Submit'] == "Enviar") { $explodir = explode(";", $_POST['Emails']); foreach ($explodir as $exp) { if (strpos($exp, ',') !== false) {…
-
0
votes3
answers396
viewsA: Why does the php string sometimes return instead of a few accented letters?
This occurs mainly in the return of data from your database, as its content may be as iso and uft8 data, or vice versa. Try using the following function to convert the data to utf8: echo…
-
0
votes3
answers9219
viewsA: json_encode returning "Malformed UTF-8 characters, possibly incorrectly encoded"
Use md_convert_encoding() in return, following example: $data = mb_convert_encoding($data,"UTF-8","auto"); $json = json_encode($data);
-
7
votes3
answers6427
viewsA: When should I use Empty or isset?
The function names themselves already say it all, isset() to check if really the variable is set and prevent errors, Empty() is complicated, for you to really know if a value is empty (no spaces,…
-
0
votes2
answers135
viewsA: Picking wrong id when selecting line with Checkbox
If I understand correctly, you want to send multiple lines, right? The way you’re doing is just sending a form, because you’re putting a form for each line, I think the following might help:…
-
0
votes1
answer59
viewsA: Updating the Listing Data
You will have to execute a callback ajax at the completion of the modal edition to update the listing data, otherwise only using redirect to the customers page (refresh). EDIT: I had not realized…
-
0
votes0
answers390
viewsQ: Slim 3 Framework - hosted in subdirectory
I have an api hosted on the local development machine in the following directory: root/www/api/v2 If I access by serving by apache, my routes are not recognized, not even if I access by…
-
2
votes5
answers83787
viewsA: Passing variables through the URL using friendly URL via GET
The answers above are excellent solutions, but I’m going to ask you a very simple question, why don’t you use a framework? Everyone already solves their problem by default. In addition to…
-
0
votes4
answers327
views -
0
votes2
answers579
viewsA: How to convert a date that is in string format in the database when doing a query?
In php use: echo date('d/m/Y') Another question, why are you using it in the local format? Is this configured in the bank? Usually date fields in database use the DATE field type, this will provide…
-
1
votes1
answer1467
viewsA: How to redirect domain . com . htaccess
That should help. RewriteEngine on RewriteRule ^(.*)$ http://www.example.com.br/en [R=301,L] Or try it this way: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST}…