I once found an article with the differences between how PHP and Ruby handle different types of variables matched with certain testing conditions (ie: isempty, isset, etc). How do they differ?
...
i have code as follows:
$("#item_select").change(function()
{
var params = $("#item_select option:selected").val();
$.post('/account/ar_form.php', {idata: params}, function(data){
$("#message_display" ).html(data);
});
});
This is a dropdown that uses
/account/ar_form.php to display html in the div correctly.
B...
In a string like "abc fox fox fox ghi xyz" how can i get the number of times 'fox' is repeated in the string?
...
Edit: I have this line:
$comments = "http://www.kiubbo.com/index.php?action=comments&param=".$articles[$index]->getId();
And if I put it here it works out in the title tag, but not on the link or guid tags.
fwrite ($fp, "<item>\n");
fwrite ($fp, " <title>$title</title>\n");
fwrite ($fp, " <link>$comments</link>\n");
fwrite ($...
We would like to some processing in a Java application, store the results in our pool of memcache servers, and read it back using memcache in PHP.
This is easy enough to try, but I though I would ask and see if anyone else has done this.
As long as both the Java and PHP clients connect to the same pool of memcache servers, will both cl...
So some guy at some other company thought it would be awesome if instead of using soap or xml-rpc or rest or any other reasonable communication protocol he just embedded all of his response as cookies in the header.
I need to pull these cookies out as hopefully an array from this curl response. If I have to waste a bunch of my life wri...
Has anyone used apc_define_constants or hidef vs using define. Any true benefits or possible bugs in the latest versions?
apc-define-constants - http://us2.php.net/manual/en/function.apc-define-constants.php
hidef - http://pecl.php.net/package/hidef
...
I'm currently trying to pull data from MYSQL using PHP and I keep getting the following error:
"Could not retrieve records: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%PC4198% OR oem LIKE %Fluke%' at line 1 "
My SQL statement is as follows:
$sq...
Hi All
I would like to know if its possible to get 2 sums from one query using the table values and then add them togther.
Here is some simple table & data which might help.
CREATE TABLE `cartcontents` (
`id` int(11) NOT NULL auto_increment,
`code` varchar(40) NOT NULL,
`qty` int(10) NOT NULL,
`price` decimal(30,2) NOT NUL...
Ok, so I'm used to working with C# and ASP.NET which automatically allows one to display database results immediately on the same page from which they were requested.
I am, however, now using PHP which I haven't coded in in years. I have the results popping up in a separate page because the form tag's 'action' option is set to that spec...
I write this code
function get_feed(){
// Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss('http://dorar.shamekh.ws/?feed=rss2');
$maxitems = 1;
$items = array_slice($rss->items, 0, $maxitems,false);
return $items;
}
ass a part of plugin for wordpress , its work fine in my local server , but when I uploa...
After reading a few posts here I formulated this function which is sort of a mishmash of a bunch of others:
function outputFile( $filePath, $fileName, $mimeType = '' ) {
// Setup
$mimeTypes = array(
'pdf' => 'application/pdf',
'txt' => 'text/plain',
'html' => 'text/html',
'exe' => 'application/oct...
This works great in PHP
date_default_timezone_set('my/timezone');
$actualDate = date('Y-m-d');
Now when doing queries, I like to do
INSERT INTO articles (title, insert_date) VALUES ('My Title', now())
The problem with this is the now() in the MySQL is different to what it would be had it been calculated in PHP (and therefore again...
I am creating a __get() function for a class to control access to my private member variables. Do I need to design the function to handle all possible member value reads or can I not write it for members that are public? Also, I am assuming that classes that inherit this class will use my __get() function to access private members.
cl...
I have 2 tables...
Table1:
ID, Name, Country
Table2:
ID, accountID, parent
table1.id = table2.acountID
My script does a search for all records with a particular parent.
I want to compare those results with table1 and return all entries that wern't in the search.
eg.
Table1:
1, Bill, AU
2, Charles, US
3, Clare, CA
Table2:
1, 1...
I have discovered that results coming from my SQL Server are having the field names truncated:
$query = "SELECT some_really_really_long_field_name FROM ..."
...
print_r($row);
array(
'some_really_really_long_field_n' => 'value'
)
Does anyone know how to avoid this behaviour?
I think the database driver is ADODB.
So you don't ha...
I have received the task to make a social graph, where, with one user in the center, it shows the connections he has.
But before we can reach that, our focus is how we can determine the shortest path between 2 users. I found some algorithm to do it, but it seems that it takes a lot of time, and because it's about social links, we are loo...
I have a PHP file that executes multiple sql scripts. I find that the first two scripts execute, but the last two never seem to complete. I tested the last two scripts individually in their own PHP files and the scripts worked, so I'm wondering if it's because of the number of exec() calls I'm making in my PHP script. Any suggestions? He...
Hello
How to use twitter api with "http basic auth"?
I think I should use the "consumer key"! because twitter gave you limit rate of requests per hour, how can they count my requests if I didn't use my consumer key?
...