php

fgetcsv - Add Quotes to fields that do not have quotes

Hello all, I have a text file (its comma delimited with some fields wrapped around in double quotes) when I parse through it using this: if (($handle = fopen('C:\tester\fake.txt', "r")) !== FALSE) { while (($data = fgetcsv($handle, ",")) !== FALSE) { $num = count($data); //echo "<p> $num fields in line $row: <br /><...

Help with MYSQL query using PHP to build a blog archive navigation menu.

I am building a blog archive navigation menu. Currently I run a query to get all the years and months. Then I loop through and run the following query to get all id's and titles of that year/months blog posts: SELECT `id`, `title` FROM `news` WHERE YEAR(`date`) = "2010" AND MONTH(`date`) = "03" ORDER BY `date` DESC After that, to...

Php SQL Server table value parameter

I am using php against SQL Server 2008 using the mssql driver. Anyone know of a way to pass a table value parameter into stored procedure? ...

Apache mod_rewrite, redirect to an URL when a file with a particular extension is requested

Hi! I would like to use mod_rewrite to transform a URL like this one: http://example.com/qxs/app/myapp.qxs into http://example.com/qxs/index.php?page=myapp Currently I have this: Options +FollowSymlinks RewriteEngine on RewriteRule ^app/([^/\.]+).qxs /qxs/index.php?page=$1 [L] But this ends up in an endless loop or something ca...

Codeigniter Cookies Help

Hello in codeigniter how would I check if the user is visiting the site for the first time, and if they are set a cookie? I am already using the Session library and database sessions which stores the session_id etc, but I need to to be able to check if the user is a first time visitor and if they have a cookie already ` $cookie = ar...

PHP open zip read contents

Ok I have a little php, application or whatever that opens a zip and reads the content. But it only works SOME of the time... sometimes when I upload the .zip and try to view contents, it works and echos back each file to me, but some other times ( yes i have a lot of .zip files ), it returns these errors: Warning: zip_read() expects pa...

PHP MVC view looping

I have a template for a "blog preview" - which is basically just a thumbnail, title, and short excerpt of said blog in a nice concise structure built for repetition in a list. As hinted above, I intend to pull the top 10 blogs on my site from the DB in my model, transfer them to the controller, which will supply them as for the view. In...

Generating Thumbnail, Copying It To Directory & Saving it To Database

Hi All, I am wanting to use a pre-authored script to generate a thumbnail of an image, and I need to modify it to my needs, by having it copy the saved file to another directory, and saving the filename to a mysql database. But I am unsure where to do that in the script, as I can't determine when the actual file is output by the script(...

How-to XHTML 1.1 validate an ampersand without escaping it?

My issue is the following. I have a XHTML 1.1 page that has a form and input fields. One of the input fields contains a value which is an URI. This URI contains key-value pairs with ampersand (&) as argument separator, that will be passed as a GET request by another web application in the browser. Usually I would use the entity &amp; to...

PHP file_get_contents with php intact?

As opposed to using an include, which executes the included php in the file...is it possible to save the contents of a php file to a variable - but with the php still intact and executable? My goal looks something like: $template = some_imaginary_include_function('myfile.php'); foreach($list_of_blogs as $blog) { // somehow get blog...

Better Capture to Session Affiliate Id from GET in PHP

Can someone help me clean this up and make it more logical? I'm fried right now and can't seem to get a good line of code written :) I'm trying to capture affiliate id from urls like ?aid=3056677. The idea is IF aff id is set in GET that takes precedence, the session and finally cookie with least. Also, we don't want to set an aff id th...

PHP Unset via References

I have been reading the PHP manual about references and something is confusing me. It says that references are not pointers to memory addresses but rather... Instead, they are symbol table aliases. Isn't this essentially a pointer if the reference points to the symbol table entry which then points to a memory address? Edit: So...

What are the MySql, FlatFile Database Differences?

I mean whats the difference between mysql and flat file database is it really slower to have "ff db"? ...

Incorrect comments set for php in vim

My vim used to auto-continue comments in php. For example: /* | <- cursor here Then, pressing Enter gives me: /* * | <- cursor here and again, gives me: /* * * | <- cursor here etc... As far as I understand it, this is controlled by the comments and formatoptions options. However, whenever I open a php file now, comments ...

applying UML in PHP

most of the books that I have read on UML uses the Java language to show examples (one notable book is the ICONIX book from Apress entitle UML-Driven Object Modeling with ICONIX). The book follows several steps using UML diagrams and then implemented in JSP. Are there methodologies to "formally" implement UML diagrams in PHP? (something ...

database schema revision control in php based webapp

We have a php/mysql based application which has slightly different instances for a number of customers. Also we have more than one developer working on the code base. What is a good way to manage changes to the database schema in this scenario? Should we require developers to write a small script when a DB change is needed? I'm think...

php mail() set hostname on windows

Using the PHP mail() function is it possible to set a fully-qualified hostname for mail requests? The development environment is using Windows and using a Postfix mail server specified in php.ini using the SMTP directive. The problem is PHP is not using a fully-qualified hostname and I'm getting an error message like this: SMTP server...

PHPDoc: @return void necessary?

Is it really necessary do something like this: /** * ... * * @return void */ I have quite a few methods that don't have a return value, and it seems really redundant to put something like this in the comment. Would it be considered bad form to leave it out? ...

How to setup PHP to be a "pipe" for downloads from another location?

I'm wanting to setup a php script and host it on my server that will let me download files from other locations, but making it look like it's coming from my server. Maybe using curl or htacess. Also I was hoping that there would be a way to get around having my server deal with the bandwidth. Does that make sense? Is this doable? --...

install quercus in glassfish?

i have downloaded the latest quercus 4.0.3 war-file from http://quercus.caucho.com/ how do you install quercus in glassfish? i followed this old tutorial for a old quercus version but it didnt work: http://weblogs.java.net/blog/ludo/archive/2007/03/100_java_quercu.html has someone successfully implemented quercus in glassfish and co...