php

CakePHP Controller interaction question...

I have two separate controller, view, database combos: Users and Jobs. Users contains: id, name, jobid. Jobs contains: id, name, wage. In my user container, I want to retrieve my job name and wage to send to the user view. I wanted to know what is the best practices here. I have tried two methods: 1.) $this->requestAction('/Jobs/getA...

Are prepared statements cached server-side across multiple page loads with PHP?

I learnt about prepared statements when making a JDBC-enabled Java application, and my app uses a connection pooling layer that assures me that prepared statements are cached server-side and this gives a performance benefit. However, with PHP everything I've read says that they are only cached for the life of the page load. Generally I ...

What is the equivalent of ASP.NET's WebRequest in php?

What is the equivalent of ASP.NET's WebRequest in php? ...

How to dual license my open source software ?

I am working on an ORM in PHP and would like to dual license it: One open source license for open source projects One commercial license for commercial projects However, I was approached by an organizer of a "coding fest" which wanted to use my project for an open source coding event. I am not sure if it would be smart to let other d...

How can I wrap the PHP PDO class into my own class?

Sorry if this is wrong or confusing I am very new to using classes and I would like to start learning more about using PDO with mysql. Here is an example code from php.net <?php /* Execute a prepared statement by passing an array of values */ $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < ? AND ...

[Apache] RewriteRule removing trailing dot.

Hi, here is my .htaccess rules: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(.*)/(.*)$ index.php?var1=$1&item=$2&var2=%{REQUEST_URI} [NC,L] RewriteRule ^(.*)$ index.php?var1=$1 [NC] here is an url: http://loc...

how do I get month from date in mysql

I want to be able to fetch results from mysql with a statement like this: SELECT * FROM table WHERE amount > 1000 But I want to fetch the result constrained to a certain a month and year (based on input from user)... I was trying like this: SELECT * FROM table WHERE amount > 1000 AND dateStart = MONTH('$m') ...$m...

Unsetting a variable vs setting to ''

Is it better form to do one of the following? If not, is one of them faster than the other? unset($variable); or to do $variable = ''; ...

Mysql delete query deletes only two columns in a row...!!

Hi all... I have a table with the following structure.... FIELD TYPE EXTRA faciltiy_id int auto_increment(Primary Key) hotel_id int facility_title varchar(20) facility_desc varchar(300) When i want to delete a row with a particular facility_id i use the code.... DELETE FR...

Reporting Engine Guidance (Pentaho, JasperReports, BIRT)

Hi, I've spent 4-5 hours or so in various forumns and at their websites researching reporting tools that can aid me in my development. I'm new to using tools like this and could use a bit of specific guidance. I'm working on an web app that will be hosted on one server, but accessed by multiple users through login. Each user will ha...

PHP: Loading up an HTML file without it tidying my code

I am using the loadhtml function (http://php.net/manual/en/domdocument.loadhtml.phpt) to load up an external .html file. When I load it, it "tidy's" up my code, which, I don't want. I do NOT want a full HTML document, I only want html snippets in my .html, and I don't want the loadhtml file to try to make it valid html, because I don't...

Errors with basic PHP template using eval()

I'm just about ready to cry. I have read the php.net manual page, tried a dozen Google searches with various phrases, and scanned hundreds of stackoverflow threads. I have seen this method in use, but it just doesn't work for me. It seems so basic. I have a couple related questions or problems I don't know how to find answers to. The im...

Opensource Online IDE

There're several online IDEs for PHP and some even for Python, but is there any open-source online IDE like IDEone that supports atleast the major languages (PHP, Python, Ruby etc..)? ...

how to hide a json object from source code of a page??

iam using json object in my php file but i dont want my json object to be displayed in source code as it increases my page size a lot. this is what im doing in php $json = new Services_JSON(); $arr = array(); $qs=mysql_query("my own query"); while($obj = mysql_fetch_object($qs)) { $arr[] = $obj; } $total=sizeof($arr); $jsn_obj='{"a...

PHP and BitTorrents

How can I read / decode a .torrent file with PHP? Do I need any specific library to decode such files or is it something simpler? ...

Stripp external unwanted CSS or extra background contents from FCKeditor

Hi All, Is there any method available to strip unwanted background content (external css) being submitted to server by FCKeditor? Currently many users are directly copying from web contents or from external editors like MS Word 7 which adds unwanted stuff in background while storing data to database. For e.g. when i copy pasted content...

redirect to the current page

What is the best way to redirect the user coming from one URL to another? I have 2 locations. http:mysite.com http://public.mysite.com I want the users who type http://mysite.com to be redirected to http://public.mysite.com It would have been easy if there were 2 different index.php files, but the index.php file is the same in both th...

PHP function to generate v4 UUID

So I've been doing some digging around and I've been trying to piece together a function that generates a valid v4 UUID in PHP. This is the closest I've been able to come. My knowledge in hex, decimal, binary, PHP's bitwise operators and the like is nearly non existant. This function generates a valid v4 UUID up until one area. A v4 UUID...

Cant open a https website with php and fopen

I am using fopen to retreive the contents of a URL. It works on http URLs but not https URLs Can anyone see why?? <?php //this works fine echo ("<br><br>url 1 is ".OutputURL("http://nuenergy.acornsoftware.com.au/staff/interface/index.php")); //returns nothing echo ("<br><br>url 2 is ".OutputURL("https://nuenergy.acornsoftware.com.au/...

How to be sure my web app gets the next tweet after specified tweet.

I am creating a webapp that relies on following a status timeline from twitter in php I am making a request to the twitter using the following API call: $since_id is equal to a stored id based on the last parsed tweet. $req_url = 'http://twitter.com/statuses/friends_timeline.xml?count=20&amp;page=1&amp;since_id='.$since_id; I have no...