Hi,
I need to start a PHP script via Apache - which will basically continue to run - it will be used for a small instant messaging widget - so it must continually run to update other users on new messages. What timeout features or other barriers should I be weary of in Apache? Will some feature of Apache not allow me to run a PHP proc...
I have next and previous links in the html
<a href="/event-sort/calendar/2009/9/sports/">prev</a>
<a href="/event-sort/calendar/2009/11/sports/">next</a>
When they are clicked, I want the page to make an ajax call to load a php script that will update the calendar's html
now when the calendar updates, the arrows have been removed and...
I would like to insert some value into a table, which has an auto-incrementing field as a primary key. Then I want to retrieve the ID by using mysql_insert_id() and use this ID as a foreign key in another table. The problem is - although very unlikely - it may happen that between the first insertion and the later retrieving, another inse...
Hello,
I am building a blog site and am having trouble with updating fields in my MYSQL database. Whenever I hit the update button on the form that uses PHP, it adds extra space before the text string in the MYSQL text field. Here is the PHP code:
//UPDATE TEXT
$updated_text = $_POST['text'.$the_post['ID'][$n]];
if ($updated_t...
I am looking for an open-source survey system for our department. PHP or Java are both OK. I checked LimeSurvey, but I don't like it.
Which open-source survey system is the best now?
...
I have the following JSON:
{"nickname":"xadoc","level":4,"loc":"Tulsa, OK, USA","score":122597,"money":29412.5,"streetNum":8,"streets":{"-91607259\/387798111":{"name":"Alam\u00e9da Ant\u00f3nio S\u00e9rgio","value":243,"type":1},"-91016823\/388182402":{"name":"Autoestrada do Norte","value":18304,"type":1},"-86897820\/399032795":{"name"...
The values will be in this format 123-123-123-12345 that I would like the preg_match to work for. Can you see anything wrong with this regEx?
foreach($elem as $key=>$value) {
// Have tried this With and without the + before the $ as well
if(preg_match("/^[0-9]{3}\-[0-9]{3}\-[0-9]{3}\-[0-9]{5}+$/", $value)) {
echo "Yeah matc...
I'm new to PHP and this may be a stupid question to ask, so don't vote me down just because I don't understand something...
php -r "print_r(simplexml_load_file('http://twitter.com/statuses/user_timeline/31139114.rss'));"
let's take this for an example, by running this command i get (on screen) XML output.
my question is it possible t...
I have an array of strings that I want to try and match to the end of a normal string. I'm not sure the best way to do this in PHP.
This is sorta what I am trying to do:
Example:
Input: abcde
Search array: er, wr, de
Match: de
My first thought was to write a loop that goes through the array and crafts a regular expr...
Hello there
I am using an objected oriented MVC framework in PHP (Kohana) and have kind of mashed together a few techniques to get stuff done. Problem is I am not sure how to keep things clean without calling lots and lots of queries per page.
To illustrate my example, I'll imagine I am designing a stack overflow like site:
I have ...
I have a DATE, how do i write a where that checks for last month until now (either the first of or just todays day -1month).
...
Is it possible to use PHP within an XSL document?
Always when I try to do so I get errors... so before freaking out I'd like to know whether or not it's even possible. (I am an absolute beginner)
...
I'm looking for a way to generate a big random number with PHP, something like:
mt_rand($lower, $upper);
The closer I've seen is gmp_random() however it doesn't allow me to specify the lower and upper boundaries only the number of bits per limb (which I've no idea what it is).
EDIT: Axsuuls answer seems to be pretty close to what I w...
I've tried this: http://be.php.net/manual/en/function.mysql-list-fields.php, but there's too much detail here.
What I'm looking for is a function that returns an array of strings. This array should only contain the names of all columns that a certain table has.
So for instance, if I have a table with these columns:
username | email | ...
Hi,
what is the fastest way to generate a random two long alphanumeric character?
Thanks,
Max
...
The only error level in PHP that will halt the script but can be caught and dealt with have to be triggered with the trigger_error() function correct? I'm referring to the "E_USER_ERROR" error level. The "E_ERROR" error will simply halt the script and I can't do anything about it as the developer.
...
Since there doesn't seem to be any support for optimistic locking in CakePHP, I'm taking a stab at building a behaviour that implements it. After a little research into behaviours, I think I could run a query in the beforeSave event to check that the version field hasn't changed.
However, I'd rather implement the check by changing the ...
Hello. I'm working with PHP 5 here. I have the following code:
$data = json_decode($_POST['data']);
foreach ($data as $obj) {
......
}
I get the error "Invalid argument supplied for foreach()" on the line with the foreach function. This only happens on my shared server account. On my local webserver everything works fine. $_POST['dat...
What s the best design pattern or best practice for data access (database access or file system access) in Distributed J2EE, .Net Environment, rails or php ?
...
Uh, and it's broken:
I had a perfectly working regex that allowed all the numbers, letters and only e-mail relevant punctuation (._-@) to sanitize my email fields, and then I thought it would be nice adding a proper email regex, checking for the correct pattern. This is what I have now:
function check_chars_email($str) {
$str_replace =...