php

Unknown Error in Facebook Apps. when get user info.

The problem is.. that when I try to login the user and then get the user info, I get error from Facebook API. with error code: 1 The same code works for one server, but not another one. THe config and everything are the same, except the non-working one is hosted at RackSpace cloud environment. I don't know if that's the cuase. Informa...

MySQL: use the id of the row being inserted in the insert statement itself

I'm trying to some something like that: INSERT INTO dir_pictures SET filename=CONCAT(picture_id,'-test'); picture_id is my primary key, auto-increment. Basically I'm trying to put the id of this insert statement, in the statement itself. I'm sure it can be done with some extra PHP code or using more than one statements, but I was won...

Batch Send Email with SwiftMailer

Hello all, I'm currently using SwiftMailer to send out emails to several users (up to 50). I have it set up and working properly, however, I'm not quite sure how to pull the recipients from my MySQL database and iterate to send them. Here is what I currently have: <?php require_once 'swift/lib/swift_required.php'; $mailer = Swift_M...

PHP Split a string with start and stop value

I have fooled around with regex but can't seem to get it to work. I have a file called includes/header.php I am converting the file into one big string so that I can pull out a certain portion of the code to paste in the html of my document. $str = file_get_contents('includes/header.php'); From here I am trying to get return only th...

How to redirect old "ugly" urls to seo-friendly ones?

Hi! I'm new to mod_rewrite and need to do something for my client. Suppose I have the www.mydomain.com/products.php?prod_id=32. This product has a section (clothes) and a name (shirt). These names and sections are unique. In a SEO-Friendly Url, it should be www.mydomain.com/products/clothes/shirt/. I know I can create RewriteRule ^...

Trimming string variables by reference in PHP5

I saw another post suggesting using this statement to trim string variables contained in the array: $_POST=array_map('trim', $_POST); However, if in the first place, the strings are not contained in an array, I would like to have a trim function that can be used like this: $a=' aaa '; $b=' bbb '; $c=' ccc '; trimAll($a,$b,$c); //a...

Is PHP suited for Enterprise Application development ?

Is PHP suitable for Enterprise Application Development ? ...

How to combine images inside pdf by programme?

Suppose there are two pdf files,each contains a single image. How to combine them from left to right? If there is no way to do in with PHP,you can do it in other languages as well. ...

Getting the first instance of an item in an array.

$string = array('A','B','C','A','B','C'); For example first instance of C in $string would be 2 Is there a simpler way to do this than doing a complex loop in php? ...

Hanging request ram issue

I would like to provide a PHP hanging request that will stay open until new events exists, at which point it will immediately return back JSON encoded data to javascript client. Connection -> wait for events (check, sleep, check, sleep, etc) -> event is detected -> send events back -> close request. CPU load is no issue with this confi...

Cannot redeclare class mdb2_error in Pear MDB2 package

I haven't install pear in my PC,instead I download the packages and unzip them to "libs" dictionary in my web-app.the structure of dictionary of my web-app is roughly like this: web-app +-/backend +-/libs +-/peardb +-pear.php +-pear5.php +-mdb2.php +-/mdb2 The application works fine in my t...

Should I make another table or just use arrays? (To normalize or not to normalize)

The current situation is that topics are sorted by 3 main categories. There is the potential to add more than just the 3 categories but the higher ups wish to implement the ability to add more than just 1 category to a topic. My original db design has the the categoryID as a Foreign Key in the topic info table. Which was probably a ...

PHP Random Numbers

i need to print out numbers 1-100 in a random order. the print statement should be: echo 'h{'.$num.'}'; what is the shortest code to do this? ...

Displaying rows, extracted from a database, one by one in a DataGrid

I have a table (session) in a database which has almost 72,000 rows. I extract those rows with the help php+mysql but when the result is returned to the HTTPService, i need to wait for some 32 seconds before the all the rows start appearing in the DataGrid at once. Question Is there any way by which DataGrid may start displaying data on...

ECommerce, products in category and category browsing

Hi Everyone, I am building an EC website for a customer and the project manager came with some strange ideas and I am struggling to actually implement what he sold to the client. Here comes my main issue and a quick summary how the system is setup: product are inside categories, categories could be children of an another category. So ...

Flash and php become very slow, same code!!

I did a flash application, login form in flash, authenticate in php, that was 3 months ago, the sending requests and response is very fast, means, when i click submit button, within 3 - 5 seconds it will has response from php. Recently, i do another login in flash, using similar code as the previously i have done. Now, the sending reque...

Rotation in PHP's regex

How can you match the following words by PHP, either by regex/globbing/...? Examples INNO, heppeh, isi, pekkep, dadad, mum My attempt would be to make a regex which has 3 parts: 1st match match [a-zA-Z]* [a-zA-Z]? rotation of the 1st match // Problem here! The part 3 is the problem, since I do not know...

what you mean by Unable to resolve resource bundle "datamanagement" error occured in flex?

when will i add Advanced data grid in my project then it shows eror like everity and Description Path Resource Location Creation Time Id Unable to resolve resource bundle "datamanagement". but separte mxml file then add it not show any errors .my project i used locale binding for multi language so i add in complier -locale=English,Ja...

How can I store more than one value in a SQL table's column?

I am using PHP. I need to store the multiple values at a single column. The values are come from depending on the checkbox selected. I didnt use the array for checkbox name. What can I do? ...

Flex: showing output of a C file in a text Area

I managed to show the output of a shell command in TextArea of flex by calling following php file via HTTPService and then using the dataprovider attribute of TextArea to show the returned output. <?php $output = shell_exec('ls -l'); return $output ?> Now i have a C file which prints some lines (by using printf command of C) when i ru...