I’m trying to send 0x01 HEX as Byte using the socket_write($socket, XXXX , 1); function. There is part of documentation: “…If yes, server will reply to module 0x01, if not – replay 0x00. Server must send answer – 1 Byte in HEX format.” Answer There are multiple alternatives: When using…
Tag: php
lastInsertId() for UPDATE in Prepared Statement
The code above does not work. The value I am trying to get is primary key auto increment. As lastInsertId() suggests by its name, it may be intended for insert only. If so, what is the proper way to achieve the same goal on an UPDATE? The value I wish to return is the primary key of the table, if
Split string into 2 letters
I am trying to split a string into 1, 2 and 3 segments. For example, i currently have this: Which works well on 1 character splitting, I get: However when I try: I get: Is there a way so that I can output this? : and then also with 3 characters like this? Answer Here it is: PHPFiddle Link: http://phpfiddle.or…
CryptoJS encrypts AES with passphrase but PHP decrypt needs a key
I am using CryptoJS to encrypt a string: As I understand it, CryptoJS uses the passphrase to generate a key, which is then used to encrypt the data. However I’d like to decrypt the cipher using a PHP function, or maybe an online tool such as this: http://aesencryption.net/ The issue is that these expect…
zf2 change language dynamically
I have one question, about ZF2 Translator, in the specific case in the costruction the link for change langauge dunamically when user click on flag or menu link. In My Application/config/module.config.php i have this code: and my route is: And in my Application/Module.php i set this code on bootstrap: now my …
How to add PHP pagination in array’s
I’ve been trying a lot of ways to add PHP pagination. I have tried searching and trying to figure other ways of implementing the pagination but none of them work. Here’s how I created the Index page: I would like to know how I can paginate the the array list. Thanks! Answer u can use simple PHP fu…
Mysqli class not found. Using percona, php5-fpm, nginx, phalcon
Fatal error: Class ‘TKStdlibmysqli’ not found in /var/www/tk-browser-app/application/library/tk-stdlib/DbAbstract.php on line 28 It sounds like I need mysqli installed. Yea I know, but it says it’s …
Pico CMS custom header
Im trying to include dynamc custom header in PicoCMS. Simple “include ‘header.php’;” wont work since the theme have only index.html file and and I cant include PHP in it. My guess is I would have to make a custom plugin for this to work but Im not shure how to do it. They have some doc…
mysqli_fetch_array returning only one result
I’m trying to make a very, very simple query of a small mysql database, using the following code (with appropriate values in $host, etc.): As you can see, I printed out the results in a human-readable way, yielding: There are a few example universities in that column, so I’m not sure what I’…
Resolve namespaces with SimpleXML regardless of structure or namespace
I got a Google Shopping feed like this (extract): Now, SimpleXML can read the “title” and “description” tags but it can’t read the tags with “g:” prefix. There are solutions on stackoverflow for this specific case, using the “children” function. But I don&…