php

PHP cannot find my php files if not under htdocs folder

By someone's advice I've put all my PHP files in a separate folder (inc) on the same level as htdocs. Only index.php is left in htdocs. So, it's like this: C:\myproject\htdocs - index.php C:\myproject\inc - login.php - util.php - register.php ... Now, when I go to localhost in my browser index.php is processed and shown correctly. But...

Using JQuery varaible inside $( php)

Hi , i am having a ajax post like var ht = $.ajax({ type: "GET", url: "http://localhost/FormBuilder/index.php/forms/viewChoices/"+attribute_id, async: false }).responseText; var myObject = eval('(' + ht + ')'); var data = myObject;var j=0; alert(data.choices);//alerts the choices as object $(""+<?php e...

Suggestion for a efficient Pagination tutorial?

I have looped data from mysql, and it's a pretty long list. What's the most efficient way to do pagination? Currently, I am looking at this one: http://www.evolt.org/node/19340 Feel free to recommend a better one, thanks ! ...

Is there any way to Upload Video Files using PHP ?

I want to upload and store video files to my server using PHP. Could any one please provide me the code? Please keep in mind that these files are generally larger than 200 MB. ...

PHP Regex Quantify

Hello, This regex only allows alphanumeric characters and one period. I haven't be able to figure out how to set a quantifier to limit the number of characters to say between five and twenty. I'm using it in PHP. /^([a-zA-Z0-9\.](?!\.)|[a-zA-Z0-9]*\.(?!\.))[a-zA-Z0-9]*$/ ...

mod_rewrite - splitting up arbitary number of terms?

heya, I'm attempting to write a mod_rewrite rule to remap some friendly URLs for searches, and my regex-fu isn't that good...lol. Basically, in the URL, after the subdomain, there will be a variable number of words (\w), separated by a character (say +). An empty expression is allowed (i.e. "foo.bar.com"), and then after that, somethin...

Should I keep reconnecting to mysql in PHP?

I have a pretty large site and every page is built from several included files, my site is 100% in a procedural format and I am trying to learn to use classes and a more OOP approach in PHP. Currently my site has a header file that is included into every page, in this header is a mysql connection that is made and last the duration of ...

In PHP should I use WHILE with a mysql result or an array?

Below is just a mockup of 2 codes in php/mysql. The first one returns a mysql result and run a while loop to iterate the results, the second one does almost the same thing but instead puts the result into a query and then puts it to screen. Now for a more OO approach the second method would be better I think (not sure, i'm learning) how...

PHP5 include() Problem

Hi all, So, I've got task from my boss to install opendocman on our newly installed PHP5 running on openbsd. When I try to install opendocman on my ubuntu laptop (running 9.04) it was run smoothly. But, when I try to install in on server, I've got these error: Warning: include(templates_c/%%0E^0E4^0E407559%%footer.tpl.php) [function.in...

What is a good approach to working with images in PHP?

Save one image path in the database... and whenever a call is made to output a smaller size of that image, dynamically resize it , assign it to a variable and call that variable? Resize image during upload and create thumbnails of it according to your needs and have database columns for the original image path and the resized image path...

Adding a 2nd Sidebar in a specific Wordpress theme

I learned how to add additional sidebars now I need to figure out how to add an extra sidebar besides the one already displayed in the theme Librio ( wordpress.org/extend/themes/librio ). I absolutely have no idea where to look. The code is pure chaos and not self explanatory. My sidebar.php contains the following code: <div id="idont...

How to check data server side before opening a javascript window

I have an issue going on here. I am using PHP to get values from a database in a php script. What I would ideally like to do is test to see if there is any data to display server side and if there is, pop up a javascript window with the values. I have this working right now with javascript. Currently, the user can look up data and press...

how to append url code from database to domain name and redirect with php?

i am on half of url shortening system i get the url from user then create code in mysql for that.Then i have to append coming code to my domain name(now i am working on localhost) like http://localhost/a5c3 then redirect it to real domain.I stuck in here.Code snippet would be good for me at least to understand what i am going to do or yo...

Converting content of text area into an array

I have a form with a text area in html. I want to get the content of this text area in php so that each line can be stored in an array. I tried using implode with'/n'. but its not working. how can i do that. Here is my code $notes = explode('/n',$_POST['notes']); ...

How do I export facebook photos to website and save / print the photos?

I came across moo.com (a printing website) that allows me to import my personal photos from Facebook. The photos were then displayed in a gallery format and I was able to drag and drop photos I would like to print. What kind of programming language do they use and how do they do it? Any legal issues surrounding such import application? ...

Auto-posting in PHPBB3 + manipulating/restoring user session

I ran into an issue that I haven't found a perfect solution for yet. First let me outline the scenario. I have a PHPBB3 forum on a server and also an application (developed by me) on the same server which is linked to the forum. The application is only accessible if you are logged in to the forum and also some parts of it are only access...

How to change the format of timestamp in CakePHP?

In my application,I retrieve a timestamp from the table which is of the format 2009-08-18 12:09:01. I need to change this to August 18th,2009 or 18 Aug,2009. How to achieve this in CakePHP? Are there any built in methods? ...

How do I execute a PHP shell script as an Automator action on Mac OS X

Hi, I'm tempted by Automator.app's ability to create contextual services in Mac OS X Snow Leopard. I would like to create some keyboard accessible shortcuts to manipulate text snippets by calling a shell script. However, Automator only suggests bash, Perl, Python and Ruby (among others) to allow this. But, since PHP also ships with Mac ...

AMFPHP & PHP - Return xml data with tags. Do not want.

I'm using the simplexml extentsion and AMFPHP to send xml data to flash. Say I have this xml: <?xml version="1.0" encoding="ISO-8859-1"?> <people> <person> <name>bob</name> </person> </people> And I load it in with simplexml_load_file(). When I do this: $name = $xml->person[0]->name; return $name; it returns "<name>bob</nam...

How to use GNUPG and Crypt_GPG

Hiya, I'm trying to use GNUPG and Crypt_GPG to encrypt data ready to be sent across email to a client server but i'm having problems setting it up. I've installed GNUPG on the server, and it works just fine, located in /home/myserver/.gnupg I've installed Crypt_GPG into /home/myserver/php/Crypt and edited the various files to have ab...