php

Php Db schema diagram creator

Hello, Wondering if there is any php script out there which takes an sql db and diagramatically shows the entire thing (along with relationships)? Similar to what most mysql tools offer for desktop. Thank you very much. ...

Is it possible to write a great PHP app which uses Unicode?

My next web application project will make extensive use of Unicode. I usually use PHP and CodeIgniter however Unicode is not one of PHP's strong points. Is there a PHP tool out there that can help me get Unicode working well in PHP? Or should I take the opportunity to look into alternatives such as Python? ...

Infrastructure required for a large Scale PHP Project

Hi My team is developing a large music portal in PHP. It is hoped that the portal will have 1 million+ users within a year of its launch. The portal will allow users to create playlists, stream and download music. Till now, we have developed applications that have been used by a maximum of about a 1000 simultaneous users. This portal ...

How can I shorten the URL query paramters?

Hi Everyone, My script is generating a very long URL just like the one below and I wonder how this can be shorten with an algorithm or technique? This is the long URL: http://example.com/script.php?param1=value1&param2=value2&param3=value3&param4=value4&param5=value5 I want to shorten it to something like this: http://...

What PHP ORM Is Most Like NHibernate?

I am looking at using an ORM in PHP for the first time. Until now my PHP projects have been fairly small and an ORM seemed like overkill. I really like NHibernate so I was hoping that there is an ORM out there for PHP that works and is configured similarly to NHibernate. If there is one with a fluent interface like Fluent NHibernate tha...

What are the best practices for consuming REST based WCF services from PHP?

We have a website built in PHP and are trying to enable it to talk to couple of services that are going to be written in WCF and follow REST Style architecture for web services. Anybody have any best practices? issues? ...

When to send HTTP status code?

Currently in my PHP scripts, I redirect the user to a custom 404 not found error page when he/she tries to access content that doesn't exist or doesn't belong to that user. Like so: header('Location: http://www.mydomain.com/error/notfound/'); exit; I realize the above header() call sends a 302 redirect status code by default. What I ...

How can I get HTML syntax highlighting in my editor for CakePHP?

I use Notepad++ and Aptana for editing my CakePHP code? Is there any way to get basic html syntax highlighting for CakePHP's .ctp template files? It's a lot harder for me without any coloring going on. Any ideas? ...

Is there an equivent library to Java's DisplayTag in PHP?

For a long time in the Java/JSP world I used to use the Display Tag library to generate a table that would allow you to sort a table, and export the table as a CSV file. Is there anything like this in a PHP library that I could use? ...

Multidimensional Arrays in PHP

How do i add items into a multidimensional array? Basically i am making an application which calculates what people are buying in a suppermarket and how much of it. Sue buys 2 tubs of butter and 1. toothpaste John buys 1 peach and 1 banana. I think the array would look something like this $sue[butter] = array(); $sue[butt...

How to convert this PHP script into C# ?

I got the following code from this question: http://stackoverflow.com/questions/539920/what-is-the-best-way-to-clean-a-string-for-placement-in-a-url-like-the-question $str = strtolower( preg_replace( array('/[^a-z0-9\- ]/i', '/[ \-]+/'), array('', '-'), $urlPart ) ); This code works for me with PHP, its making clean and SEO'd ur...

Updating web app from Zend Framework 1.7 to 1.8

Hi! I'm trying to update my current project from 1.7 to 1.8. What do I have to change so that it does not break? ...

MySQL - ignore insert error: duplicate entry

I am working in PHP. Please what's the proper way of inserting new records into the DB, which has unique field. I am inserting lot of records in a batch and I just want the new ones to be inserted and I don't want any error for the duplicate entry. Is there only way to first make a SELECT and to see if the entry is already there before...

How to create friendly URL in php?

Hi, normally, the practice or very old way of displaying some profile page is like this: www.domain.com/profile.php?u=12345 where u=12345 is the user id. recent years, I found some website, their url very nice, its like: www.domain.com/profile/12345 How do I do this in php? Please teach me, thanks EDIT: Just a wild guess, is it some...

Are there any session security loopholes in my PHP script?

After I authenticate user login info, i create this session for them: $_SESSION['username']= $userName; Then, I redirect them like this: header('Location:www.domain.com/profile/' . $_SESSION['username']; I want my website to have a beauty URL, something like: www.domain.com/profile/userName Thus, in all my redirect links (HTML <a...

mysql_real_escape_string() completely removes string

I'm escaping all the string parameters I receive from a php form like this: $usr_name = mysql_real_escape_string($_REQUEST['usr_name']); to avoid a few problems with SQL Injection. But when I my string back from the function, I end up with nothing. Also I keep getting this weird warning in my PHP log: PHP Warning: mysql_real_escap...

php intval() and floor() return value that is too low?

Because the float data type in PHP is inaccurate, and a FLOAT in MySQL takes up more space than an INT (and is inaccurate), I always store prices as INTs, multipling by 100 before storing to ensure we have exactly 2 decimal places of precision. However I believe PHP is misbehaving. Example code: echo "<pre>"; $price = "1.15"; echo "Pri...

How to store special characters (', ", &, etc) in mysql database, so they can be searchable?

Im having a small problem with storage of special characters like quotes, double quotes and ampersands. I put every POST request through mysql_real_escape_string(), and when I add a string like "That '70s Show" it gets stored as "That &#x27;70s Show" in the mysql DB. When I echo it out, it works fine... but when I try to run a % $string ...

In cakephp how can I do a find with conditions on a realted field?

I've got a model (Listings) that has and belongs to a few different models, I'd like to find all of this model where it's related model (Openhouses) have a condition. The 'has and belongs to' are setup in the model files. Listings hasmany Openhouses and Openhouses belong to Listings. (And listings has many and blongs to a few other model...

http://localhost/ not working on Windows 7. What's the problem?

I have a big problem opening http://localhost/ on Windows 7 (beta). I installed this os and everything went great; when I installed Wamp I saw that localhost is not working at all. I just see this error: Failed to Connect Firefox can't establish a connection to the server at localhost. in Mozilla and Explorer. I removed Wamp ...