php

Remove .php extension with PHP

Hello fellows! I could use some help here. I'm using this to fix my URL but I can't figure out how to remove the .php extension. The URL looks like this now: http://mydomain.com/page.php/foo/123/bar/456 function decode_URL_parameters() { $path = @$_SERVER['PATH_INFO']; $url_array=explode('/',$path); array_shift($url_array); ...

video on website with php

Hi, I'm writing a web application where users can submit pictures, videos, and descriptons of points on a Google Map. I have the application written except for the video uploading. I've read about ffmpeg to convert uploaded videos and I've also read you need a flash video player for the users to view your videos. The server-side of my s...

Concise way to check variable presence in MySQL INSERT QUERY using PHP

I am writing a PHP script to add items to a shopping basket. My shopping basket table has fields for the userid, product id, session id, notes and a few others. Some of the fields can be blank. For example: if someone isn't signed in, then I will store their session id in the table and, if they sign in, add their userid so I have a perm...

Trying to select something within text with a regex

Hi, My company has a series of websites with very similar domain names based on the city. The format for these is http://locksmithdallas.com or http://locksmithgarland.com. I'd like to figure out a way to interpret Dallas and Garland out of the domain names in php. I'm a noob at regex, so I could really use some help! ...

Multiple instances of SlideToggle which toggle everything.

I have the following script which appears multiple times on my page. I have a simple slide toggle attached to <div class="info"> and contolled by <a rel="viewinfo"> tag, but when I click on the anchor, all the divs with class info slide. here is the HTML/PHP <div class="couplistMeta"> <a class='view' rel="viewinfo" href="#">View C...

Why does this PHP code hang on calls to mysql_query()?

I'm having trouble with this PHP script where I get the error Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/vhosts/richmondcondo411.com/httpdocs/places.php on line 77 The code hangs here: function getLocationsFromTable($table){ $query = "SELECT * FROM `$table`"; if( ! $queryResult = mysql_query($...

Text file into an array?

In php how can I read a text file and get each line into an array? I found this code which does it somewhat but looks for a = sign and I need to look for a new line <?PHP $file_handle = fopen("dictionary.txt", "rb"); while (!feof($file_handle) ) { $line_of_text = fgets($file_handle); $parts = explode('=', $line_of_text); print $parts[...

Zend Framework + Uplodify Flash Uploader Troubles

I've been trying to get the Uploadify flash uploader (www.uploadify.com) to work with Zend Framework, with no success so far. I have placed all Uploadify files under /public/flash-uploader directory. In the controller I include all required files and libraries like this: $this->view->headScript()->appendFile('/js/jquery-1.3.2.min.js')...

What to use if i want to repeat set of parameters in php libcurl session

I'm trying to do multiple things in curl and obviously some parameters in each step will be the same... should i use curl copy handle or curl setopt array? As far as i understand both do the same thing... or i'm getting something wrong? ...

Keywords from String

Hi there, Does anyone know of an available PHP function that takes a piece of text, with say a few hundreds of words long and produces an array of keywords? Ie. the most important, frequently occuring unique terms? Thanks Philip ...

Passing a PHP array in a SOAP call

So I am trying to include the following XML in my SOAP request: <Responses> <Response> <QuestionAnswerID>someint</QuestionAnswerID> <QuestionID>someint</QuestionID> </Response> <Response> <QuestionAnswerID>someint</QuestionAnswerID> <QuestionID>someint</QuestionID> </Response> </Responses>...

How should i set up my classes?

I'm starting to work with oop to build a site of user generated data. There are different types of data coming from my classes. I have functions that get a list of data from the database, and functions to just select one item from those lists. For example function Get_Article($aid); //Gets an article function Get_Users_Articles($uid);...

Is there a way to get all of a DOMElement's attributes?

I'm reading some XML with PHP and currently using the DOMDocument class to do so. I need a way to grab the names and values of a tag's (instance of DOMElement) attributes, without knowing beforehand what any of them are. The documentation doesn't seem to offer anything like this. I know that I can get an attribute's value if I have its n...

MySql & PHP: How to find which row has an item in the leading spot in a CSV list?

This is kind of a weird question so my title is just as weird. This is a voting app so I have a table called ballots that has a two important fields: username and ballot. The field ballot is a VARCHAR but it basically stores a list of 25 ids (numbers from 1-200) as CSVs. For example it might be: 22,12,1,3,4,5,6,7,... And another one ...

Guid/Uuid in PHP with MySQL

I'd like to store uuids in the database as BINARY(16) but I need to accept them and present them as the XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX format. Before I jump to split the guid in PHP code (what a fun that is!), are there any libraries or functions that do this out-of-the-box? ...

Parameters vs. Attributes(class variables)?

In OOP, is it better to use class attributes within class functions, or just pass parameters to them. class User{ private $user = array(); public function Get_Existing_User($user_id){ //SQL selects user info for existing user $this->user = mysqli_fetch_assoc(); } public function Set_User($user_data){ $this->user = ...

json encoded random generated number is always the same on ie8

i have a php function which returns a random json encoded color <?php function randNum() { return rand(0, 255); } $color = array ('r'=>randNum(),'g'=>randNum(),'b'=>randNum()); echo json_encode($color); ?> on the page i have a jquery function that whenever an event occurs, asks for a color and changes the win...

Need to Assess whether Joomla is good fit for Web Application Requirement

Hello, I have a web application that needs to be built using PHP/MySQL. The application will require documents to be generated from data in the MySQL database. Such documents will be printed and/or emailed and user will be prompted to run a daily print/email job based on business logic. This application functionality needs to be ma...

Is it crazy to not rely on a caching system like memcached nowadays ( for dynamic sites )?

I was just reviewing one of my client's applications which uses some old outdated php framework that doesn't rely on caching at all and is pretty much completely database dependent. I figure I'll just rewrite it from scratch because it's really outdated and in this rewrite I want to implement a caching system. It'd be nice if I could ge...

Best CMS for a T-Shirt catalog website

Hi my friend who's studying CSS wants to make a simple t-shirt catalog website. He also wants to include e-commerece in the future. What's an easy to learn CMS--preferrably in PHP--do you guys suggest for him? ...