Hi,
For example, there's remote API with the following calls:
getGroupCapacity(group)
setGroupCapacity(group, quantity)
getNumberOfItemsInGroup(group)
addItemToGroup(group, item)
deleteItemFromGroup(group, item)
The task is to add some item to some group. Groups have capacity.
So first we should check if group is not full. If it is,...
I have a mysql database table filled with 1000+ records, lets say 5000 records. Each record has a processed boolean flag, default to false (0). What I'd like to do is have a PHP script run on cron every minute. Its code would be something like this:
<?php
process();
function process()
{
$sql = "SELECT id FROM items WHERE processed =...
I Have Text in the middle of <b></b> Eg:
La <b>la</b>: the 1 <br></br>Aventuroj <b>aventuro</b>: adventure 2 <br></br>de <b>de</b>: by, from, of, since 3 <br></br>Mirlando <b>miri</b>: marvel, marvel at, wonder<br/><b>lando</b>: country, land 4 <br></br>by <b>ba</b>: bah, nuts, pooh 5 <br></br>for <b>for</b>: away 6 <...
Basic question - I have a text area with a submit button that is linked to the variable $ListItem.
Further down the page I want to print $ListItem in a <li> and everytime something new is entered in the text area, I want to assign it a new variable ($ListItem2 perhaps?) and then print it below the previous one.
With my current code, ...
Hi,
While I was developing with Magento, I found out that I don't need to put php end tag (?>) if I don't use HTML below PHP code. Is it safe and why don't we just put end tag?? Is it useful??
...
In PHP, I'd like to get the details about a function call inside the function itself. The behavior I want (without doing this) is to have debug_backtrace() passed as an argument to the function.
I want that done automatically, for every call to a function.
I need this so I can have pre-defined errors for a fairly sizable project I'm wo...
Is there in the world analogues of JavaBeans or JAXB for PHP?
Is it possible to generate PHP classes from XML schema?
It's common practice to publish API's as XSD schemas. Java and C# guys can get advantage of this by generating classes right from XSD. Is there same tool for PHP?
...
Is there a way I can get my the following function ported correctly to the the Zend_Form_Element? I have a custom element and i am passing my own options in for the details of what I am working on: below is the PHP and following will be the INI
$html = $this->helper->formBlah(array(
'name'=>'foo',
'value...
I am trying to save a string of html into the nodeValue attribute of a DOMElement in PHP, but after I save the file with DOMDocument->saveHTMLFile the string of HTML is escaped and I can not figure out how to get the string not be saved as escaped text. Any ideas?
...
I was going through some of the code for Dolphin CMS recently (a craptastic example for PHP haters) when I ran across this little gem in /grp.php:
{
switch ( $_REQUEST['action'] ) {
//a crapton of switch statements
}
}
I'm curious what the wrapping curly braces, "{}" without any keywords, are about. I do PHP developmen...
We'll be developing a booking engine, a 4-5 step checkout process for reserving rooms with a hotel where there's a lot of complexity involved. Something similar to this.
Has anyone used Selenium for something like this? What kind of tests would I be able to do? Could I set something like Selenium to go through the entire process of step...
Please help, Im trying to search for mysql records using an html form to display the corresponding record for the entered primary key.
Here's my html form:
<td><input type="submit" name="Submit" value="Search"></td>
And here's the new.php form action:,
mysql_select_db("Hospital", $con);
$result = mysql_query("SELEC...
The real, full contents of the file:
<?php
error_reporting(E_ALL);
ini_set(display_errors, 'on');
try {
//$x = strtotime('blah');
$x = new DateTime('lol');
} catch ( Exception $e ) {
echo $e->getMessage();
}
The DateTime constructor accepts a string, which should throw an exception if it can't parse it. This runs f...
hi,
i'am developing an application that sends mails using SMTP servers in PHP
got success in sending mails using SMTP services but i could not find out how to use proxy servers in sending mails.
could any one help me in this issue please?
Thanks in advance.
...
I have been through a fair bit of the code in modules/database/classes/ but still have not found how to return the last insert Id.
How do I get this?
...
hi everyone ,i am new to php i am working on image upload to folder and displaying it from the same folder and added checkbox to each diasplayed image.. but my problem is images are displaying one below the other but i want to diasply each image and the corresponding checkbox in sperate column can any one pls help me out in this thanks i...
I have a big MySQL users table and need to get six random rows from it (I'm using PHP). The table has an index column that is auto incremented. The only problem is that some rows are marked as inactive, because some users have disabled their accounts or whatever. That means I can't just count the rows and then grab a random number from t...
I'm writing a PHP library that has a Number class that uses the bcmath extension for arbitrary precision.
I have two questions:
How much slower is bcmath compared to using the built-in int and float types?
bcmath has an optional scale argument (that defaults to 3 digits). For an general purpose Number class that anyone could use, wha...
on search i want to check if query is latitude and longitude or just text search with php.
$query = '-122.0307642, 37.3316930';
latitude and longitude can have '-' in them also.
what preg_match pattern it will be for this?
...
I have a question related to phing. Do I use it on my local development machine to deploy an application or do I call it via ssh from production machine? I'm not sure where to do the steps from Eran Galperin (What is your preferred PHP deployment strategy). I'm a beginner with deployment scripts. So be forgiving :)
Marco
...