php

"if" versus "switch"

Possible Duplicate: is else if faster than switch() case ? I've encountered a lot of situations lately where I have very simple conditionals and need to branch application flow. The "simplest" means of accomplishing what I'm doing is just a plain old if/elseif statement: if($value == "foo") { // ... } elseif($value == "ba...

Live video streaming like ustream.com?

I have a customer that is currently using ustream.com as his live video streaming service. Basically he has a site for local sports where they stream the games. The problem is, ustream does not keep a copy of the videos for archiving for watching later. Basically I'm looking for a php/mysql compatible solution for having him handle the ...

PHP, text echos out of database without new line, all in one piece.

Hi guys, I have a longtext in a database. It looks fine from php_mayadmin, but when I echo it out to a page, it loose all formatting, i.e. no new lines, all in one chunk. Any ideas? :) Thanks! ...

Simple PHP Screen Scraping Function

I'm experimenting with autoblogging (i.e., RSS-driven blog posting) using WordPress, and all that's missing is a component to automattically fill in the content of the post with the content that the RSS's URL links to (RSS is irrelevant to the solution). Using standard PHP 5, how could I create a function called fetchHTML([URL]) that re...

Client HTTP Post to external sites

Is there any web language that allows the client itself to create HTTP posts to external sites. I know that JavaScript does this with XMLHttpRequest, but it does not allow cross-domain posting, unless the recipient domain wants to allow the sending domain. I want to post data to an external site (that I don't control) and have the requ...

Header already.... when header() is used...PHP

Hello, When I use header( 'Location: http://www.yoursite.com/new_page.html' ) ; which is a PHP redirection of page, it says header already passed at line.... The landing page as <? include('header.php'); ?> How can I over come this error message? Appreciate assistance. Thanks Jean ...

PHP Includes in Apache Password Protected Directories

(THIS IS A DUPLICATE, I FORGOT A TAG, PLEASE FORGIVE) I'm writing a small CMS for a client using my own little framework and am running into one issue (not 100% sure it's an issue, but I'm sensing it will be). So, for example, I have a News.php class that handles all of my Blog updates (CMS user input) and output (display of blog data ...

Help accessing xml attribute in php

Hi, I'm new to php and coding in general. I'm trying to parse xml from a remote device and access specific value data. I would like to display group 9 probe 1 value for example and I cannot get it to work. Any tips? Here is the xml: <?xml version="1.0" encoding="ISO-8859-1" ?> - <Device id="S10011" hb="1935"> <Group id="1" /> ...

How to convert time like 2 pm or 3 am to HH:MM:SS format in php?

How can i convert times like 2 pm or 3 am to HH:MM:SS format in php? Thats all what my question is. Regards Zeeshan ...

how to install bcmath mdoule?

how to install bcmath module on a server? I tried yum update php-bcmath but it said it found nothing. please advise. ...

How to get order output after using group in the sql query?

Hi, I have a my sql table with customer names and orders that they placed over time. table column names are id, customer name, order value, status, and created and modified. I am able to group customer names and number of orders. using a sql query like this.. SELECT Customer,count(OrderPrice) FROM Orders GROUP BY Customer It work...

php arrange table content from horizontal to vertical

Hello I have a script which read a csv file. <?php echo '<table border="0" cellspacing="1" cellpadding="1" class="sortable" border="1"><caption>Title Here</caption> <thead><tr><th class="header">Time:</th><th class="header">Value 1:</th><th class="header">Value 2:</th><th class="header">Value 3:</td class="header"><th class="header">...

XSLT comparing/sorting using a param passed from PHP

I'm having an issue doing conditional tests and sorts using params passed into the xsl file from PHP. I can do a match based on testing a string value, and can sort using an explicit name, but cannot get the variables to work in doing either. Here is the XSL and a fragment of the relevant XML. <Products xmlns:b="http://www.viator.com/af...

JQuery removing and adding classes

I'm trying to use JQuery to add/remove classes as part of a function that uses links to switch around the main content divs on my site. Here is my JavaScript: $(document).ready(function () { var clickHandler = function (link) { $('.tab').hide(); $('#options_' + link.data.id).show(); $('.selected').removeClass('selected...

Linkshare callback error.

I keep getting this error for linkshare. *REPORTING ERROR: Our reporting servers are currently unavailable. We apologize for the inconvenience, please try again later.* What i am trying to do is call the api and get the results. on our website, when some user clicks on any linkshare banner, and make a purchase then certain points are ...

In PHP, I need to make a POST request, but one of the variables must be a text file. How do I do it?

Here's what I need to do. In my PHP script, I need to make a POST request, but one of the arguments must be sent as a text file named data.txt. I already wrote a little script that will send the POST request and send the arguments. The server expects an argument that's an array with two elements, arg0 and arg1. arg0 is a regular string, ...

I need a tool that allows me to quickly generate html and xquery it

At the moment I have a nice class that generates HTML and allows me to create pages without having to worry about things like closing tags, proper nesting, or clear formatting. The syntax is simple and straight forward, //Create an anchor tag $anchor = new Tag("a", array("name"=>"anchor"); //Create a paragraph $paragraph = Tag::Craft("...

PHP - Using a constant's value to reference a data member.

Hello, I am trying to access one class object's data member by using a constant. I was wondering if this is possible with a syntax similar to what I am using? When I attempt to do this in the following script I get this error: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM class Certificate { const BALANCE = 'cert_ba...

how do i convert this array?

hello, i have the following array: ["addToCart"]=> array(3) { [1]=> array(5) { ["aantal"]=> int(1) ["film_id"]=> string(1) "1" ["zaal_id"]=> string(1) "1" ["dag"]=> string(7) "maandag" ["seats"]=> array(4) { [0]=> string(2) "67" [1]=> s...

OO PHP Class method renamed to variables?

Hello fellow PHP geeks, I'm sort of in a weird situation... One of which I've never come into before (It's maybe due to my break from PHP to .Net). Using the framework CodeIgniter. Well here's the situation... I've got a User class which acts as the user object containing username/password/email etc... (shown below): <?php if ( ! def...