If 0 could be a possible key returned from array_search(), what would be the best method for testing if an element exists in an array using this function (or any php function; if there’s a better one, please share)? I was trying to do this: But that would of course return false if $needle is the first e…
How to make a PHP based script for finding UK addresses by entering postcode?
I’ve almost looked everywhere but nothing found, so my only hope would be here though! 🙁 I want to make a PHP based script for finding UK address by entering postcode, so a list would show with a …
Look at array and count true or false from duplicate values
I have a table in SQL, where users can answer many times (the same users and different users). I want to count how many true or false values there are. For example, like user 1 has 5 rows in my table, …
How to connect to a mysql database in C# and mimic the SELECT, UPDATE and INSERT functions
How can I connect to a MySQL database in C#, and use it to UPDATE values in the database, INSERT values in the database and SELECT values from the database. Also, is it possible to get the value of …
Test if string could be boolean PHP
I’m getting a string from a $_GET and I want to test if it could be a boolean, before I use it for a part of a mysql query. Is there a better way of doing it than: Answer There’s, by the way, a cleaner way of writing it: But yes. The one you wrote down is the only way.
Building custom PHP extension (.so)
I own a high traffic website that does business in the USA and Canada. We have lots of servers but I want to make sure it’s 100% available with no latency whatsoever. I’ve learned about creating custom extensions (I know a little C) and I want to create custom validation/files (since php extension…
PHP XOR Decryption
I have an encrypted parameter V coming from a web page like this: V is encrypted like above: MD5 : XOR : which gives something like: what I want here is the function to decrypt this ‘ecryptedXOR’ using the password, so that I can get the: here’s what I’ve done so far: http://pastebin.c…
subtract 6 hours from date(‘g:i a’, strtotime($time_date_data));
I am using the following code to transform a universal time code into something a little more user friendly. But now I need to subtract 6 hours from meeting_time. Should I do it after the code above or can I work it into the same date function? Something like: Answer String-to-time (strtotime) returns a Unix …
Select Random Row from SQL Using PHP
I want to request 5 random rows from my SQL table using php. for instance, i need to: Answer Edit: For what its worth, Please note that using rand() on a table with large number of rows is going to be slow. This can actually crash your server. Some Solution: MediaWiki uses an interesting trick (for Wikipedia&…
How to send file from PHP-script to another PHP-script in code?
I have some web-form which posts some data and user file to first php script. First script wants to upload received from form file which located at $_FILE variable to second php script (second script …