php

php associative arrays, regex, array

I currently have the following code : $content = " $content = " <name>Manufacturer</name><value>John Deere</value><name>Year</name><value>2001</value><name>Location</name><value>NSW</value><name>Hours</name><value>6320</value>"; I need to find a method to create and array as name=>value . E.g Manufacturer => John Deere. Can anyone ...

Jquery, ajax and the ampersand conundrum....

I know that I should encodeURI any url passed to anything else, because I read this: http://www.digitalbart.com/jquery-and-urlencode/ I want to share the current time of the current track I am listening to. So I installed the excellent yoururls shortener. And I have a bit of code that puts all the bits together, and makes the following:...

how to search for retweets based on hashtag in php?

Also, how can i retrieve the results of the s hashtag search and see who all have retweeted that tweet in php. I have seen the api but did not find much info on hashtag search. did find other normal search but i wanted to search based on hashtag. Suggestions please ...

How to create a virtual scroller?

I want to create a table to grid some data. The table can list a lot of data (100K+ rows). So what I want to do is show like 20 rows at a time with maybe a 100 row buffer. As the user scrolls down on the grid, it loads in the extra rows via ajax? I have seen this done but I don't really know how that can be achieved? ...

Asking data in AJAX

hello.. i tried these two codes but it is not functioning.. i only want to ask for the data output from another domain from http://vrynxzent.info/hello.php first code $.post("http://vrynxzent.info/hello.php",function(e){ alert(e); }); second code alert(askData()); function askData() { var strUrlList = "http://vrynxzent.info/hel...

How can I implement a custom reorganization function that returns a nested array?

I have this data coming from a database which pulls all subcategories and relevant info: $data = array( array( 'destination_name' => 'Ohio Resort', 'destination_slug' => 'ohio', 'subcategory_name' => 'Bird Hunting', 'subcategory_slug' => 'bird-hunting', 'category_name' => 'Hunting', 'c...

Why is PHP not interpreted in FF but is interpreted in Chrome on my website?

Look at this URL in Chrome and Firefox. http://gymshuffle.com/contact.html If FF, there's uninterpreted PHP code on the page. In Chrome there isn't. What would cause the PHP to display in Firefox? ...

How to combine an array of keys with corresponding values from another array?

I have 2 arrays Array ( [1] => Manufacturer [2] => Location [3] => Hours [4] => Model ) and Array ( [Manufacturer] => John Deere [Location] => NSW [Hours] => 6320 ) I need to combine them and associate the values from the first array( Manufacturer, Location, hours , Model) as names in the 2nd array and if a specific values f...

How to run my script from another script and wait for finish?

I need to call a script called build_report.php, pass in a URL variable named partno and wait until it is finished before continuing. This script builds a report and then an email is sent out to our customer so I don't want the email sent until the report is generated. Is this possible? Which should I use exec or cURL? ...

Having huge problems getting memcached plugin working on ub 9.04

Heya, so I've spent about 6 hours now trying to get this working. I had the following set of rules I uses to compile in the memcached plugin to php, installing libmemcached dependency first. Here are the steps: cd ~ sudo wget http://download.tangent.org/libmemcached-0.35.tar.gz sudo tar -zxf libmemcached-0.35.tar.gz cd libmemcache...

Get Full URL with PHP & Include Subdomain

I have been using the following to discover the full url, but it does not detect the subdomain I am calling from. $current_url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"].""; echo $current_url;EXIT; Any advice? ...

Using LIKE to search for a name

I have a table which contains contact information. This table has 1 column relevant to names. It looks like this: Sort Name: Doe, John Clinton, Bill Dooby Doo, Scooby Sadly, there are no first name / last name columns, and they can't be added. If a user enters the search term "john doe", is there any way I can get mysql to return the ...

Find closest match for misspelled city names?

I have a list of cities that have numerous incorrect spelling for the same city. One city is misspelled 18 times! I am trying to clean this up but its taking hours. Is there some algorithm that might "guess" at the valid city name for each of these misspelled ones? Some form of weighting? The data is in MySQL and I do have a table o...

Comet-style messaging: How to implement server part without polling?

I'm planning a chat-like web application, where whenever one user posts something, all other users (that is, people with their browser pointing to that site) would get instant updates. The common choice for this is comet-style messaging using long-polling AJAX requests. Writing the client-side part with jQuery isn't much of a problem. ...

PHP Oauth signature_invalid

I can't wrap my brain around why this isn't work... I really think it should be. Please help. Here is the error I get: signature_invalid base_string:GET&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetRequestToken&oauth_callback%3Dhttp%253A%252F%252Fnoveis.net%252Fauthsub%252Findex.php%26oauth_consumer_key%CONSUMER KEY HERE%26oauth_n...

Join in the same table?

I have to perform a SELECT operation in the DB. Since I want to narrow down the search results, I was wondering if I should use nested SELECTs or use a JOIN operation? I want to perform a dual search on the table. I unsuccessfully tried this: $receive_listings = mysql_query('SELECT * from show_detai...

How to create a custom front page redirect for anonymous user?

I have a web site at what-i.com that uses Drupal Commons profile. I have created a custom theme called 'whati' and placed it in /sites/all/themes folder. My page-front.tpl.php is supposed to drive my front page. It has an if-else statements for 2 scenarios: logged in and non-logged in users. For logged in users, everything works great:...

unable to access single_cat_title() after clicking a post

$skin_type = "green"; $category_id = get_cat_ID( single_cat_title("", false)); if($category_id == 218){ $skin_type = "blue"; } I have this code at the top of my header to select different backgrounds for my categories. It works great when navigating between Categories with the menu, but it single_cat_title() does seem to work whe...

PHP Append to empty string without error.

Hey folks, I have got the following issue, my function appends code to a string $string ($string .= bla), but in the beginning the string is empty, so I get this error message A PHP Error was encountered Severity: Notice Message: Undefined variable: $string Filename: libraries/file.php Line Number: 90 Of course if I define...

How to determine user defined function parameters names before calling it?

In PHP, I have created a user defined function. Example: <?php function test($one, $two) { // do things } ?> I would like to find the names of the function parameters. How would I go about doing this? This is an example of what I would like: <?php function test($one, $two) { // do things } $params = magic_parameter_finding_...