When I run this code I give this error: mysqli_error() expects exactly 1 parameter, 0 given Its for $insert_stmt->execute() I don’t know why I have this error, because database and table is …
Tag: php
pecl install memcache fails on OS X Yosemite with “memcache support requires ZLIB”
I’m trying to perform a pecl install memcache with XAMPP on OS X Yosemite, but it fails to find zlib, producing this error: checking for the location of ZLIB… no checking for the location of zlib… configure: error: memcache support requires ZLIB. Use –with-zlib-dir= to specify prefix w…
Guzzle returns cURL error 3: malformed
I want to try out the guzzle library and am following through their quickstart tutorial to make http requests to an api. Yet it doesn’t seem to work, because I get the following error: Since I have never worked with cURL before, I don’t even know how to respond to that error message. Here is my co…
PHP/MYSQL: A removed row is still displayed in my page after a reload
I work on a simple webserver on a Raspberry Pi, displaying a MySQL table with two buttons : One (Switch) to inverse a boolean value, and one (Delete) to remove the entire row from the table. What I …
PHP Dropdown Box from SQL Join
I want to do is have a dropdown box that will display the MealOption and when that is selected somehow find that products meal id? This is my database layout
Laravel sort collection and then by key
I am making raking system for my users and here’s what I have so far: Get all users and sort them by points – it works fine. $users = User::all(); $users = $users->sortByDesc(function($item){ …
PHP Function hex2bin() doesn’t return binary strings
The php manual says that hex2bin() returns a string with a binary representation. I have this code: $hex = hex2bin(“6578616d706c65206865782064617461”); var_dump($hex); The output is: string ‘…
Get location from latitude and longitude in PHP
I want to get address, city, state and country in different variables so that I can display it separately but due to different latlong, somewhere I am getting whole address and somewhere only state and country, so I am not able to get a specific address due to changing latlong. Here is my code: Answer Try Bel…
Is it possible to enable CORS in the PHP CLI server?
Is it possible to enable CORS in the PHP CLI server (and if so, how)? Edit: To address comments such as I should just include the header in my scripts, note that I do not have any PHP files/scripts in my code. I am simply using the PHP CLI server as a lightweight local hosting option. Thus ideally the answer
Print a key in a PHP multidimensional array
I have a multidimensional array and I want to print the contents as follows: My problem is that I don’t know how to refer to the key of the first sub-array (the names). key($index) just replaces all of the names in the output with “class1”. Here’s my code so far: I’m pretty new t…