php

PHP: Join two separate mysql queries into the same json data object

I'm trying to mesh the below mysql query results into a single json object, but not quite sure how to do it properly. $id = $_POST['id']; $sql = "SELECT contracts.po_number, contracts.start_date, contracts.end_date, contracts.description, contracts.taa_required, contracts.account_overdue, jobs.id AS jobs_id, jobs.job_number, companies....

PHP string remove space.

Is there php function to remove the space inside the string? for example: $abcd="this is a test" I want to get the string: $abcd="thisisatest" How to do that? thanks. ...

Suspend file validation on Zend Framework

Hi, Currently on my application I have a form where I ask the user to upload an image file to be used as a logo. I want to allow the user to reset that to nothing by supplying no file (by just pressing the upload button from the browser). In this scenario the only thing left is to suspend file validation when no file is included. Curren...

Is it possible to detect what operating system a user is coming from using PHP? (mac or windows)

Let's say for example I wanted to echo "You are using Windows!" or "You are using Macintosh!", depending on the users OS. Is this possible? ...

PHP - UTF-16 to UTF-8(hex) conversion

Is it possible to convert UTF-16 U+610F style character to UTF-8 (hex) E6848F using PHP ? UTF-8 character is '意' ...

Appending a Query String to the End of a Function Action URL

Hello, For the code below, I would like to append echo $_SERVER['QUERY_STRING']; to the end of index.php. But when I try to do it, it makes the code return a blank page. So I think I might be doing it wrong. How can I correctly make this appendage? Thanks in advance, John <?php function show_loginform($disabled = false)...

Controlling Windows Media Player through PHP / batch files

I'm currently writing a tiny webapp for my HTPC (actually, a PC serving as both a media player and web- / fileserver) that will allow me to remotely control the playing of audio, without having to turn on my TV just to switch songs. I'm using Windows Media Player as my audio player of choice, and I thought I could control it through PHP...

CodeIgniter Encryption Class - How do I?

Hi, I have created a registration page using CI that works fine. However, I encoded the password using sha1 (see code snippet below), and now that I plan to create a login page, I need to check whether the password the user enters in the login page is the same as that password encoded using sha1 stored in the database. However, I just r...

What's open-source commenting system are available?

My site has several listing pages and on each page, I'd like to enable a commenting mechanism, but I want it to be as open source as humanly possible. This means full use of OpenID's, Facebook connect, etc. Does such a system exist that'll allow users to post their comments on my listing pages? By the way, my site utilizes a LAMP archit...

Is there a PHP equivalent function to the Python os.path.normpath()?

Is there a PHP equivalent function to the Python os.path.normpath()? Or how can i get the exactly same functionality in PHP? ...

PHP: Creating cropped thumbnails of images, problems.

Hi there, I am fairly new to PHP, and I am writing a script that will resize images. First an uploaded image is resized to 800width by *height, depending on the orientation of the file uploaded (portrait/landscape). The script is then meant to create a thumbnail of that image. The thumbnail must be 175width by 117height. This is has...

Read ssl data from PHP socket_listen()

Lets say a listening socket is created in PHP, and it accepts a secure connection. How do I know that it's encrypted and how do I decode it? ...

working with arrays

I currently do a query which goes through the records and forms an array. the print_r on query gives me this print_r($query) yields the following: Array ( [0] => ( [field1] => COMPLETE [field2] => UNKNOWN [field3] => Test comment ) [1] => ( [field1] => COMPLETE [field2] => UNKNOWN [field3] => comment here ) [2] => ( [field1] => COM...

How to create simple PHP COMET server page displaying current time?

How to create simple PHP COMET server page displaying current time? I need code implementation (because it should be trivial) - not theory or just links to library sites. Simple text line conteining corrent time and updating each second. ...

make website page get news articles from feeds

Hi, I would like to start publishing some news articles from time to time. An option would be to create a new web page for every article but this sounds like it can be done easier. For instance I noticed clear channel uses some kind of feed, like: http://www.z100.com/cc-common/news/sections/newsarticle.html?feed=104650&amp;article=701140...

Autodetect Presence of CSV Headers in a File

Short question: How do I automatically detect whether a CSV file has headers in the first row? Details: I've written a small CSV parsing engine that places the data into an object that I can access as (approximately) an in-memory database. The original code was written to parse third-party CSV with a predictable format, but I'd like t...

Why is this MySQL INSERT INTO running twice?

I'm attempting to use the mysql insert statement below to add information to a database table. When I execute the script, however, the insert statement is run twice. Here's the URL mysite.com/save.php?Body=p220,c180 Thanks in advance. <?php //tipping fees application require('base.inc.php'); require('functions.inc.php'); // conne...

Insertion failed error in MySQL.

while($row=mysql_fetch_array($result2)){ //return $row['ProjectID']; $sql="INSERT INTO `tycodashboard` (ProjectID,DesignationID,ReqcompID,IntOrgID,FinishedTimeID,ProjectStatusID,PhaseID ) VALUES('{$row['ProjectID']}','$pm,'$req','$initiating,'$initiating','$ftime,'$ProjectStatus,'$Phase)"; $res...

In Kohana 3 Is it possible to use Controller_REST and Controller_Template together?

Right now I'm using Controller_Template would like to have RESTful URLs though, is it possible to use both the controllers together somehow? Thanks. ...

Fixtures and inheritance in Symfony

Hi! I have a database schema in Symfony like this: Persona: actAs: { Timestampable: ~ } columns: primer_nombre: { type: string(255), notnull: true } segundo_nombre: { type: string(255) } apellido: { type: string(255), notnull: true } rut: { type: string(255) } email: { type: string...