Posts by Samuel Aiala Ferreira • 219 points
8 posts
-
0
votes2
answers27
viewsA: Same Cookie Shopping Cart - I can’t detect the error in the code
The problem may be here in fact $itens_carrinho[$itens][0] Why items have the array Count. My suggestion? The index of your array should always be cod_product, because that way it becomes easier for…
-
1
votes1
answer151
viewsA: Mysqli not found in Docker image
Create a Dockerfile, and install mysqli on it https://hub.docker.com/_/php reference. Go to How to install more PHP Extensions And on your Docker-Compose.yml instead of installing from an image,…
-
1
votes1
answer3164
viewsA: ERROR Uncaught Syntaxerror: Unexpected token < in JSON at position 0
Actually it is not php error this, but rather CORS which in general means that you are making a call from one server to another, without owning the other (being in the same domain). If you have…
-
0
votes1
answer54
viewsA: Transform string into array excluding repeated values
I could test like this here ? $hashtag = "#caio #azul #caio #azul #leão #orelha #caio #caio #caio"; // $hashtagArray = explode(" ", $hashtag); echo "<pre>"; print_r($hashtagArray); echo…
-
3
votes1
answer1157
viewsA: How to Instantiate a PHP Class
This is a feature called namespace http://php.net/manual/en/language.namespaces.php It serves to separate your classes logically, but they need to be "included" in the same way ... but the autoload…
-
0
votes2
answers149
viewsA: Disable case sensitive only in a comparison
The short answer is nay But as you said, you can pass the two values to strtoupper or strolower and make the comparison, or if you want to use regex you can pass the modifier /i as well.…
phpanswered Samuel Aiala Ferreira 219 -
-1
votes2
answers585
viewsA: Compare current record with previous record in loop/loop
Do so <?PHP while ($row = $result->fetch_assoc()) { // verifico as condições if ($id_ant == $row && $row['ID']==$id_ant['ID']-1){ $array[] = $row; } $id_ant = $row; } ?>…
-
1
votes3
answers710
viewsA: How to join two array variables into one in php?
Dude, take off that first bracket $return[] = array( Vira $return = array( Because this way you are creating 2 levels of array (Return[0][data]) and when you will read in js is giving Object because…
phpanswered Samuel Aiala Ferreira 219