php

Explode function in PHP

Hello, I have the following notepad file; dbName: tableName: numberOfFields: I am trying to write a php app which assigns the value of dbName to $dbName, tableName to $tableName and numberOfFields to $numFields. My code is: $handle = @fopen("config.txt", "r"); if ($handle) { while (!feof($handle)) { ...

ImageMagick: Different PDF render results when exec() in PHP?

I'm using ImageMagick to render PDFs as master JPGs as an intermediate step before making thumbnail images of various sizes, and I'm getting different results when I execute the command in PHP using exec() than I get when I run it on the command line directly. This is the command I'm using: exec("/opt/local/bin/convert -geometry 1000x1...

Joomla Template Design formating date joined with categories

I am design a template for Joomla and would need some help in formatting the output of my date. I want to look something like this "October 28th, 2009 in Design", I check my "language\en-GB\en-GB.ini" but i cant figure out how to put suffix in my 'day' ('28th') now another question would be how would I attached it in my category? (e...

Problem with cURL in PHP

At work im having a big issue getting a cURL piece of our application to work on our live environment, but it works alright on our QA servers. The server environments are "supposed" to be the same. cURL is executing, but the data is not being posted back. What i want to know is... is there something on the server that i could check to ...

MySQL Query - Result Table Name

When I query a mysql database in PHP, I can not figure out how to specify the table of the field in the result set. For example, I would like to do the following: $row = mysql_fetch_assoc($result); $row["table.FIELD"]; But, can not figure out how. Surely, it is able to happen somehow. EDIT: I have checked documentation, and have f...

How to return a 200 ok status programmatically to ajax request in PHP?

I ask this question for the comment of this answer: http://serverfault.com/questions/104648/is-this-http-servers-issue/104679#104679 EDIT I missed an important point,should also keep the connection not closed. You guys can smell I'm trying to figure out how long polling actually works. ...

a PROGRESS event when uploading ByteArray to server with AS3 & PHP

I'm currently creating a series of as3 / PHP classes that upload - encode + download images. Anyone know if there's a way to report progress while posting a ByteArray to the server? the ProgressEvent is not working - at least not in the case of uploading a ByteArray - it reports progress only after it's been uploaded here's a stripp...

Efficiency for including files of functions (in PHP)

If I had a large number of functions would it be better to keep them all in one large file or would it be better to separate them into several files of related functions. By better I mean more efficient for both maintainability and for the server processing the request. For example right now I have all my files in a file named include.p...

forcing page download in php

How do I force the browser to download the current page browsed to? a page with the header Content-type: text/plain for example using PHP? If a user navigates to that page, a download box should appear (the browser download dialog with the usual "Save As" ...

Codeigniter: Models questions!

Hi... i just got this doubt about models... This is my first 100% MVC project (kind of)... my doubt is...when ill do a join, union or whatever function with more than one table... how i do this? use the same model file of the "main table" or i need to create a new model file using the two or whatever tables?? Tkz... Roberto! ...

PHP PCRE (regex) isn't doesn't support UTF-8?

I am attempting to run a regex on my site, and I am getting this response: Compilation failed: support for \P, \p, and \X has not been compiled at offset 1 After googling for a bit, I've found that apparently my PCRE on my server is not UTF8 enabled, and is therefore causing problems. When I ssh with pcretest -C I get PCRE ver...

Print rows that dont exist in table???

Simple question. I have a query that sums rows grouped by date. Basically, it counts how many membership applications in a day and prints out the results day by day. Naturally, if there are no applications in a day, it doesnt show that row (example below 15th and 17th had no applications..... Date | Applications ------------...

CakePHP Web Crawler Memory Leak

I am developing an application that is, to put it simply, a niche based search engine. Within the application I have include a function crawl() which crawls a website and then uses the collectData() function to store the correct data from the site in the "products" table as described in the function. The visited pages are stored in a dat...

Is there a way to get basic PHP error underlining in VIM?

I really like VIM but one thing I cannot do without is simple error underlying like in netbeans and Visual Studio. I often make silly mistakes like if checkit($url) { } instead of if (checkit($url)) { } The little squiggly red underline is a lifesaver when it comes to stuff like that. Is there a plugin for VIM that wi...

Optimizing a Recursive Method In PHP

I'm writing a text tag parser and I'm currently using this recursive method to create tags of n words. Is there a way that it can be done non-recursively or at least be optimized? Assume that $this->dataArray could be a very large array. /** * A recursive function to add phrases to the tagTracker array * @param string $data * @param ...

how to parse a page that is going on 302 header??

i have to parse a page in php,the url of the page is going on 302 Moved temporarily header and is moved to a not found page.Its data can be retrieved manually through console option of firebug add on of mozilla.But if i try to parse it using php it gives me that not found page in return.How can i parse that page please suggest?? edit: i...

PHP: Displaying Korean Text in a Webpage

How to display Korean Text in a webpage. i have been using these meta tags and headers <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-language" content="ko"/> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/> ini_set('default_charset', 'UTF-8'); header('Content-Ty...

Using Subquery in Select statement.

I've got a query that outputs the following table: (0) Age <= 19----------76-------0.12 (1) Age 20 – 24--------661------1.06 (2) Age 25 – 29-------4060------6.53 (3) Age 30 – 34-------7231------11.64 (4) Age 35 – 39-------9281------14.94 (5) Age 40 – 44-------9539------15.35 Total ----------------30848 -----49.65 The first...

Replace page content before file loads?

Hi! I wanted to know, is there any sory of scripting that I can use so that I can simply change one little thing and then the content will change for multiple pages? Maybe PHP or the htaccess file. What I want to do is make an "Under Construction" page for my website, that I can periodically turn on or off. Right now, the method I am us...

PHP: Find XML node and insert child

I have an xml document with the following structure: <?xml version="1.0" encoding="UTF-8"?> <items> <item> <id>1</id> <url>www.test.com</url> </item> <item> <id>2</id> <url>www.test2.com</url> </item> </items> I would like to be able to search for a node value, such as the value of 1 for the id field. Then, on...