Hi everyone,
We're in the first steps of what will be a AJAX-based webapp where information and generated HTML will be sent backwards and forwards with the help of JSON/POST techniques.
We're able to get the data out quickly without putting to much load on the database with the help of a cache-layer that features memcached as well as d...
I do some checking of arguments in my classes in php using exception-throwing functions. I have functions that do a basic check ( ===, in_array etc ) and throw an exception on false. So I can do assertNumeric($argument, "\$argument is not numeric."); instead of
if ( ! is_numeric($argument) ) {
throw new Exception("\$argument is not ...
Hello,
For the code below, how could I put 5 spaces between "Submissions:" and $row1["countSubmissions"] ?
Thanks in advance,
John
echo '<td class="sitename5">Submissions: '.$row1["countSubmissions"].'</td>';
...
I am struggling to understand how I should design the error handling parts of my code. I recently asked a similar question about how I should go about returning server error codes to the user, eg. 404 errors. I learnt that I should handle the error from within the current part of the application; seem's simple enough.
However, what shou...
I want to write a MySQL statement like:
SELECT * FROM someTable WHERE someId IN (value1, value2, value3, ...)
The trick here is that I do not know ahead of time how many values there will be in the IN().
Obviously I know I can generate the query on the go with string manipulations, however since this will run in a loop, I was wonderi...
Hi,
The text below is the dump of a multidimensional array, dumped by the var_dump() PHP function. I need a Java function that reads a file with a content like this (attached) and returns it in XML.
For a reference, in site http://pear.php.net/package/Var_Dump/ you can find the code (in PHP) that generates dumps in XML, so all neeeded ...
My site currently uses http and https sections based on the data being collected on the site (form data uses https).
On my index page, I have the PHP code at the top:
<?php
session_start();
ob_start();
if( $_SERVER['SERVER_PORT'] == 443) {
header('Location:http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])...
I have this code:
$theQuery = mysql_query("SELECT phrase, date from wordList WHERE group='nouns'");
while($getWords=mysql_fetch_array($theQuery)) {
echo "$getWords[phrase] created on $getWords[date]<br>";
}
The query has 75,000 results, and every time I run the code I get an error.
...
I have a function in my model that I need to use multiple conditions when querying. Additionally I would like to also have partial matches.
I currently have:
public function searchClient($search_term)
{
$rows = $this->fetchAll(
$this->select()
->where('first_name = ?', $search_term)
);
return $rows->toArray();
}
Wh...
I have a page that I want to redirect to that requires parameters in the URL:
http://www.mysite.com/myController/myAction/param1:val1/param2:val2
I know that there is a Cake PHP redirect function for redirecting that works as follows:
$this->redirect(array("controller" => "myController",
"action" => "myAction", ...
Take for example:
fsockopen(tcp:\\example.com, 80, $errno, $errstr, 5)
My friend has just informed me that PHP will always wait for the TCP handshake to be completed before closing the socket. However, I find it difficult to believe that PHP can't interrupt the handshake.
Is it possible? If so, how?
...
Hi, I want to start a project for facebook and the application will be like real-time multiplayer chess game. The problem I'm having is I have no idea how to store the data when a player moves one piece and update the new position in player2 browser. I'm gonna use PHP, MySQL for server side and jQuery for Client Rendering. The simplest i...
Hi everyone...
I have a website displaying data from MySQL in a php file (/something.php).... i want to copy the source code of that page as HTML so i can use it in a textfield box so users can copy paste that code...
It's almost like an HTML generator using info from mySQL, so users can custimize each HTML code.
I have everything cov...
I have texts in UTF-8 with diacritic characters also, and would like to check if first letter of this text is upper case or lower case. How to do this?
...
I have a big list of properties that I need to map between two objects, and in one, the value that I need to map is buried inside an array. I'm hoping to avoid hard-coding the property names in the code.
If I have a class like this:
class Product {
public $colors, $sizes;
}
I can access the properties like this:
$props = array(...
Python has a nice zip function ( http://docs.python.org/library/functions.html#zip ) is there a php equivalent?
...
I have a form that currently uses PHP to insert the form entries into a MySQL database. Is it possible to insert the results directly into a SugarCRM contact table instead of a MySQL db?
...
i need php script to extract the ip address from the following xml page www.ip-address.com/test.xml
<dnstools>
<service_provider>Domain Tools</service_provider>
<provider_url>http://www.domaintools.com/</provider_url>
<date>Wed, 12 May 2010 00:43:07 GMT</date>
<unix_time>1273624987</unix_time>
<ip_address>94.252.157.241</ip_addres...
hi, i am building a shopping cart and cant figure out how to store something like this into a session.
[product_id1] = quantity;
[product_id1] = size
[product_id1] = color;
[product_id2] = quantity;
[product_id2] = size;
[product_id2] = color;
...
etc
so when a user select the quantity of a product then selects its color then select...
Lets say I have a parent class
class parent { }
.....
This parent has three sub class
class child1 { }
class child2 { }
class child3 { }
and these child classes have further smaller parts like
class child1subpar1 { }
class child1subpar2 {
public function foo() {
echo "hi";
}
}
class child2subpar1 { }...