php

States and Countries select box - best way to do it?

Hi guys, this may seem trivial but I'm setting up, on a profile form page I'm building, a countries and states select box such that when you select the US or Canada then the states box would display states of the selected countries else it would display a None Applicable instead. My countries and states are in a database and I'm populati...

Building extensive google maps based application

Hi guys, I'm working now on google maps, I'm trying to build something not even half as extensive but something on the lines of http://wikimapia.org/. Ok I'm not going to be building the whole app haven't got that much time on my hands. However the application I'm working on has users signing up and they would be able to pin point and cr...

Convert string value into html format in php

Any one know how to convert string value into html format in php? For Example: $string = "Hello World!! How are you?" If I echo $string, it will display like this: Hello World!!How are you? Instead of: Hello World!! How are you? Any way php can conver the $string into html format? If I input: $string = "Hello World!!...

SELECT * FROM in MySQLi

My site is rather extensive, and I just recently made the switch to PHP5 (call me a late bloomer). All of my MySQL query's before were built as such: "SELECT * FROM tablename WHERE field1 = 'value' && field2 = 'value2'"; This made it very easy, simple and friendly. I am now trying to make the switch to mysqli for obvious security re...

What software can I use to auto generate class diagrams in PHP?

I have some source code and I would like to auto generate class diagrams in PHP. What software can I use to do this? Duplicate http://stackoverflow.com/questions/393603/php-uml-generator http://stackoverflow.com/questions/704957/uml-tool-for-php ...

Sort using php and jquery

I'm trying to re-order a HTML table when the user clicks on the table header. Here is all I can do, but still doesn't work. in the HTML: // onClick on table header var par='ASC'; sort(par); from: ajax.js function sort(orderByType) { $.ajax({ url: "sort.php", type: "get", data: "orderby="+orderByType, success: func...

AJAX checkbox if statement

I've got a bunch of variables being pulled from form ID's before being sent in a query string to a PHP. However, as one input is a checkbox I'm trying to get AJAX to set the variables value according to whether it's checked or not. i.e.. if (document.getElementById('bold').checked) { var bold = "true"; } else { var bold = "false"; }...

multidimensional PHP array or multiple queries to mysql DB

Hi there I'm using the PHPExcel lib which it seems to do great jobs, but in my approach it doesn't seem to be so fast. I need to generate a excel file with allot of sheets, data, formulas and styles(bold, color, border) and it takes me allot of computing resources and time. I think that my approach is not so good. Which has to be the ri...

POSTing an arbitrary number of records from an HTML form

Hi I'm making a web page in which I have a list of products, along with a field next to each product in which a customer is meant to enter the quantity they want to order. The list of products is generated from a database and therefore the number of products isn't known. Is there a way of POSTing the quantity of each product ordered alo...

php and email interaction

I am working on a futur projects that will get information to a private website not from interface but from email. After some research, posterous.com is doing something interesting, posting on personal blog from email. flickr is doing the same thing with photo attached from email and post it n the server to show off My question. Where o...

Adding conditional formatting and punctuation to a set of variables

I often need to list items separated by comma, space or punctuation, addresses are a classic example (This is overkill for an address and is for the sake of an example!): echo "L$level, $unit/$num $street, $suburb, $state $postcode, $country."; //ouput: L2, 1/123 Cool St, Funky Town, ABC 2000, Australia. As simple as it sounds, is the...

Yii Framework

How do I setup Yii framework in Windows XP ?? Yii framework requires to be setup using command line, which I am not aware of, can you help ?? NTulip how kind of you to give such an awful answer. Anyways I am getting this message 'php.exe' is not recognized as an internal or external command, operable program or batch file. ...

User defined MySQL function not accessible with PHP PDO connection

I've got a trivial MySQL function: DELIMITER $$ DROP FUNCTION IF EXISTS `mydb`.`CALC` $$ CREATE FUNCTION `mydb`.`CALC_IT`(Flag VARCHAR(1), One FLOAT, Other FLOAT) RETURNS FLOAT BEGIN IF One IS NULL THEN RETURN 0; END IF; IF Other IS NULL THEN RETURN 0; END IF; IF Flag = 'Y' THEN RETURN Other - One; ELSE ...

PHP: "Global" Include

Current situation: I have the current version of my MVC Framework which uses classes as controllers. I have some "vintage" modules from my old MVC Framework which uses simple, flat includes as controllers. Much simplified that means: New Version: <?PHP class blaController extends baseController { private $intVar; function ...

What is the best way to create a "fully" modular ZF-based application?

For the past time I have been working on a Zend Framework based webshop application that we are building from scratch. The application has been successfully been set up for several clients, but we are stumbling upon more and more problems regarding extensibility and modularity of the application. A lot of clients require a lot of differ...

PHP Daemon/worker environment

Problem: I want to implement several php-worker processes who are listening on a MQ-server queue for asynchronous jobs. The problem now is that simply running this processes as daemons on a server doesn't really give me any level of control over the instances (Load, Status, locked up)...except maybe for dumping ps -aux. Because of that I...

PHP Query Fail

<?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $dbhost = 'localhost'; $dbuser = 'zuk1_boo'; $dbpass = 'lols'; $dbname = 'zuk1_boo'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $name = $_POST['name']; $iq = $_POST['iq']; $nuname = str_replace(" ", "-", $name); $nuname =...

Cross Domain Ajax Request with JQuery/PHP

Help, if you can- The situation: http://foobar.com includes a remotely hosted javacript file (http://boobar.com/stuff.js). The goal is to just get an alert from the remotely hosted php script on foobar.com I have tried the following code in stuff.js: $.ajax({ type: "GET", url: "http://www.boobar.com/script.php?callback=?", dat...

safest way to create sessions in php

i m working on a website..... and wants to create user login and their session..... what is the safest way to check their session exist or not( like cookie or session variable check)..... or any better idea then using sessions in php ...

Suggestions/Tricks for Throttling a PHP script

I have a scheduled task that runs a script on a regular basis (every hour). This script does some heavy interaction with the database and filesystem and regularly takes several minutes to run. The problem is, the server's cpu-usage spikes while the script is running and slows down normal operations. Is there a way to throttle this proces...