php

CakePHP problem bake views (EasyPHP, MySQL)

I CakePHP (cake_1.2.2.8120) and EasyPHP (3.0) installed on Windows Vista Ultimate. I followed the "baking" tutorials online, successfully set the database connection with the "cake bake" command from the CLI. I baked the controller for my "Users" table using the "php cake.php bake controller Users" command - worked fine. However, when I...

How to migrate from my WAMP environment to using MSSQL?

I have on my local PC installed WAMP environment (using WampServer OS). Now I would need to change one script from working with MySQL to MSSQL. I have no idea at all how to proceed, where to download MSSQL, how to install it and how to connect with PHP? Thank you very much ...

Dump facility in C++ like var_dump() in PHP?

Hi there When I was in college i did some C/C++, but in near future i was working in PHP, and now I wish to put more time in learning C/C++. In PHP i was using print_r() or var_dump() in order to display datas from structures or arrays. Do I have such a default functionality in C, in order to see what do i have in a struct or array? ...

I've encountered this kind of syntax: var == "" ? "-" : var. Can somebody explain?

The code is this one: $vendors[] = array( "id" => $row['vendorID'], "name" => $row['name'] == "" ? "-" : $row['name'], "tel1" => $row['phone1'] == "" ? "-" : $row['phone1'], "tel2" => $row['phone2'] == "" ? "-" : $row['phone2'], "mail" => $row['email'] == "" ? "-" : $row['email'], "web" => $row['web'] == "" ? "-"...

How To Implement A PHP/HTML Cache

I've read several guides on implementing a php cache system (my site is custom coded, fairly query heavy and growing) including this one: http://www.snipe.net/2009/03/quick-and-dirty-php-caching/ I understand them fully but there are certain parts of the page that I can't cache, what's the best way to go about doing that? ...

What is so wrong with extract()?

Hey everyone, I was recently reading this thread, on some of the worst PHP practices. In the second answer there is a mini discussion on the use of extract(), and im just wondering what all the huff is about. I personally use it to chop up a given array such as $_GET or $_POST where I then sanitize the variables later, as they have bee...

Can you create class properties dynamically in PHP ?

Is there any way to create all class properties dynamically ? For example I would like to be able to generate all class attributes from the constructor and still be able to access them after the class is instantiated like this: $class->property. To be more specific, when I'm dealing with classes that have a large number of attributes I ...

How to get server-side registry access from COM object instanciated by php?

On the server I would like to call into a dll from php. Using a COM object. This wasn't a problem, until I tried to use some WPF features. I get the following error: PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: mscorlib Description: Requested registry access is not allowed.' Thru the ProcMon uti...

Text-to-HTML converter for PHP

What text to HTML converter for PHP would you recommend? One of the examples would be Markdown, which is used here at SO. User just types some text into the text-box with some natural formatting: enters at the end of line, empty line at the end of paragraph, asterisk delimited bold text, etc. And this syntax is converted to HTML tags. ...

PHP : Passing a file to a USer defined function

I have a PHP page(registration.php) from where i would submit a file to another form(preocess.php) .So that in the next page that page will send that file as an attachment to an email id. Can i Call a function in another file and pass this file to that function ? It is some think like passing a stream to a function. (I am not sure .) Can...

Jquery, drag and drop and save to mysql database?

I have been searching all over the web, i could only found the inettuts-with-cookies, which teach how to use Jquery to perform drag and drop and then save in cookies. Can anyone please show me how to save to database (php and mysql)? I need it badly.. EDIT: First, I am not php beginner, but a AJAX beginner. Those tutorials are only fo...

Create an array using the index values from another array

OK here is what I would like to do. I have an array. What i want to do is make another array of the index values from the first one. Take the below I want to create and array from this : Array ( [identifier] => ID [label] => HouseNum [items] => Array ( [0] => Array ( ...

How can I count the total number of MySQL queries used per page?

Is there a built-in function in PHP or MySQL that will provide the total number of MySQL queries used on a page? I've seen on a lot of sites (mainly forums) they have a message at the bottom saying something like "Page generated in 0.6 seconds with 20 queries". If there's nothing built in then I'll add something to my database class to ...

php connection pooling mysql

Hi, I am planning to use MYSQL. Is there a connection pooling extension available. or what is the normal practice for connection. is this the one used in every where... mysqli_connect("localhost", "xxx", "xxx", "test"); Do people use just normal msql_connect or pconnect..? how better is pconnect and what setting should I do for PConnec...

ActiveScaffold for PHP

Ruby on Rails has a bunch of plugins which extend the normal scaffolding: Lipsiadmin Hobo Streamlined ActiveScaffold Does the PHP community have anything similar? phpmyadmin is great, but it doesn't have any way to control the presentation of the data. You always get all of the data in its presentation format. These Rails framewor...

Detect FFMPEG?

I'm writing a PHP script that converts uploaded video files to FLV on the fly, but I only want it to run that part of the script if the user has FFMPEG installed on the server. Would there be a way to detect this ahead of time? Could I perhaps run an FFMPEG command and test whether it comes back "command not found?" ...

PHP autostart with loading script

Hi, Is there a setting by which I can get some scripts to load/execute automatically once the PHP starts like getting a few constant up into global memory. and is there a global memory which is accessible across users... Also about memory is there no memory which is accessible by all users. One person set that another person access's i...

Can I use Perl CGI::Sessions data in PHP?

I'm using Perl's CGI::Session with MySQL. No problems there. I want to incorporate some other languages, most notably PHP, to use the same session cookie. How would I do that? Almost the entire site is in Perl, but I want to use free PHP things, like forums and mediawiki, and still use the same session cookie. ...

Diggbar modrewrite- How do they pass URLs through modrewrite?

With the new Diggbar, you can put http://digg.com in front of any URL that you are currently at and it will create a Digg short URL. I am only assuming they do this by modrewrite (though I am not sure since I am new at this all). How is this done? It seems to me when I try this with a website I am working on, it bombs out. I want to ...

How can I delete a charcter from string in PHP ?

How can I delete a character from string in PHP ? $s = "waseem"; Are there a function like delChar($s , 2); ? which 2 is the index of the Character , I search but I didn't find anything . any ideas ? ...