php

PHP class problem

class Gdn { const AliasDispatcher = 'Dispatcher'; protected static $_Factory = NULL; public static function Dispatcher() { $Result = self::Factory(self::AliasDispatcher); return $Result; } public static function Factory($Alias = FALSE) { if ($Alias === FALSE) return self::$_Factory; ...

Re-arrange a string using every x letter position with PHP

Hey, I'm trying to figure out how to re-arrange a string using every x position so that an example input string of "ABCDEFGHI" and the x being 4 would yield DHCIFEGBA. Here's how I got that: The 1st letter is easy: it's character 4. [A, B, C, D] The 2nd letter is also easy: it's character 8. [E, F, G, H] The 3rd letter is mostly easy:...

Jquery + php, remove dynamic rows from table td click

Hi guys, I'm trying to remove a row from a table when I click a specific row column. I'm using .live() so that I can remove rows added from a ajax request. It works fine, my problem is, the table comes from php with two rows, I can then insert new ones and remove them, but when I remove one of the rows that came with php, it remove all r...

php encrypted ssl session data

I have 2 servers running, one for the dynamic content (nginx, php) and another for login (apache2, php) i use memcache to share the session information i upgraded the server software and since then the session data in apache is encrypted apache: session::write("sessions/s53mqdhghmlrvnvjt05novt4m2","encrypted-data",0,1440) nginx: se...

flag/mark locations in google map with location name

Is it possible to mark the locations in google map dynamically with the location name. The client will provide us with the locations names through the rss feed. We will grab that location with php script (thats not a worry) and then want to mark them in google map. Say if we got the address: Weston Town Recreation Department 20 Alphabe...

PHP - Get part of string by searching for characters, instead of counting them?

With the substr() function i must enter where i want to cut the string by numbers, is there any way of cutting a string by passing words or characters? Something like this: <?php $string = "Hey there world!"; magic_substr($string, "there ", "!"); // returns "world" ?> Is there a function like that? If so, i've missed something ...

Determine if a week is odd or even

I have debugged this legacy code, and would like a sanity check on it. The purpose of it is to allow someone to choose a delivery frequency for shipping a product. If someone wants their product Every Other Week, the system needs to determine if they should get an order next week, or two weeks from now. We call it A week, or B Week. Ke...

How to know where the script stopped?

I was wondering if there was a way to know where the script stopped (ie: file + line), which would be useful for debugging or for removing stupid 'exit' calls lost somewhere in the code. Thanks in advance ...

PHP Class Redefinition Clarification

I have a LinkedIn API class that I've written for PHP that makes use of a third-party stand-alone OAuth class, not the possibly installed PECL PHP OAuth extension. I've designed it this way to allow the many users don't have the ability/access to install the PECL extension to make the needed OAuth calls. So, for PHP installs with no PE...

include after PHP 404 header returning "Oops! This link appears to be broken."

To make a long story short, I have dynamic pages on a website that display reviews. If there are no reviews associated with a particular city/county/area/etc the mysql query returns 0 rows which triggers the following code: if (!$validRevQuery) { header("HTTP/1.0 404 Not Found"); include("http://{$PDS['site']}/404.php?request="....

PHP & MySQL - How to delete a users records from two tables.

Hello I'm new to PHP & MySQL and I was wondering how can I delete all of user_id 3 records from these two tables below using PHP & MySQL? My MySQL tables CREATE TABLE ls ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, skill VARCHAR(255) DEFAULT NULL, experience VARCHAR(22) DEFAULT NULL, self_grade VARCHAR(10) DEFAULT NULL, date_created DAT...

destroy / hide element in tpl file - quick forms

Hi, I have made a element in controller file . i have a if condition in tpl file. based on this i need to show the element created in controller file. But i am unable to do it. How do i destroy the element created in controller in tpl file ? added element in controller like this $form1 = new HTML_QuickForm('form123', 'post', "unlock.p...

Question about classes.

Let's say I have a class in php, and it includes some functions. The class is named "something". When I load the file on another file, I noticed it goes like: include("the_file_with_the_class.php"); $something = new something(true); now I can do OOP, I know, like $something->the_function, but what is that "(true)" in the variable? Th...

Java OR PHP Server Side Web App and Why?

I am creating a web app that involves a lot of DB access and parsing and analysing data , Java is the language i am most comfortable with but recently have been told that I should consider to use PHP as it makes DB access protocols a lot simpler. I dont have any great knowledge of PHP but would be willing to learn for use if it was goin...

cURL - can't get POST response

Hi, I'm trying a basic thing. I have two files: curl.php and form.php curl.php <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/test/test34_curl_post/form.php"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT...

How do I remove keys from an array which are not in another array?

I have the following two arrays: EDIT On suggestion from @Wrikken I've cleaned the first array and now have this: First Array: Array ( [0] => 3 [1] => 4 [2] => 9 [3] => 11 ) Second Array: Array ( [3] => stdClass Object ( [tid] => 3 ) [12] => stdClass Object ( tid] => 12 ) [9] => stdClass O...

PHP - pclzip.lib troubles

Hi. Dunno if someone use this library to make (server-side) a zip files. Here you can see my code : $i=0; while ($row = mysql_fetch_array($query, MYSQL_NUM)) { $title[$i]=$row[1]." - ".$row[2]; // i remove some chars, because they can create confusion with the filesystem $titleontxt=$title[$i]; $title[$i]=str_replace("/...

Get multiple pages with a single fsockopen

Hy all. I need to get the content of multiple pages from a single domain. Now for each page I use an fsockopen connection, and I get the content of the page this way: <?php $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET /page1.html HTTP/1.1\r\n"; ...

How to increase your skill as a php developer

Possible Duplicate: How to increase my advanced knowledge of PHP further? (quickly) I have just finished learning the basics of PHP and MySQL and I need some kind of practical experience to improve my skill or some kind of professional job. Any idea how to do this and expand my knowledge as a PHP developer? ...

Detecting if content was sent prior to a line in a php file in codeigniter

I'm trying to change the way the error files from system/application/errors work by logging the errors and showing a 404 page instead. However, sometimes the error occurs in the middle of a page and I need to display only the error page. I've tried to check if the headers are sent and cleaning the output buffer but it didn't work. Any s...