php

PHP starter -sample kit

I am looking for a starter kit- samples for learn web development. my goal is create a ecommerce web site. ...

show data in php web

i use bigint(10) to save format date in Myphpadmin. but i can't show format d/m/Y in my website. Please! help me. i Use folow: <?php $sqldate = strtotime($row['ngaysinh']);echo date('d/m/y',$sqldate); ?> ...

Import javascript in php

Hi, How can i import javascript in php? No matter what i try, i can't seem to get the buttons in my page to trigger the events in javascript. This is my javascript file content: function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var col...

eregi include extra characters into the allowed list.

/* Check if username is not valid */ else if(!eregi("/[^a-z0-9\s\' ']/i", $subuser)){ $form->setError($field, "* Username not valid"); } How to I allow for spaces to be allowed in the eregi line?? On a sidenote... I was going to use: $input_name = preg_replace('/\s\s+/', ' ', $input_name) to strip excess white spa...

How to find out a cookie was set by javascript or server code?

Hi, I have some special cookies. I need those cookie was set by server code only. So I need to find out that cookie was set by javascript or server code. Is it possible? ...

Hourly Wage Calculation

I have a database table like this: wagetable name lowhours highhours wage Default 0 40 10 Default 40 9999 15 Brian 0 40 15 Brian 40 50 20 Brian 50 9999 22 Chad 0 40 13 Chad 40 9999 17 ...

Problem installing PHP Curl in Windows 7 64bit

I'm having problem to get PHP CURL to work on my machine. I'm using Windows 7 Home Premium Edition (64 bit). I tried to follow every single tips availble but couldn't get it to appear when I did phpinfo(). And, till now my CURL function is still not working. Enable php_curl.dll extension from php.ini Copy libeay32.dll and ssleay32.dll...

How do I create a class that contains several classes that can communicate with each other?

I'm trying to take full advantage of object oriented php and learn something along the way. Following an MVC tutorial I was able to do this: class Repository { private $vars = array(); public function __set($index, $value){ $this->vars[$index] = $value; } public function __get($index){ return $this->va...

How to get AJAX coding to go into PHP??

I have this PHP coding (See below) and I'm trying to include a Ajax drop down list into the input form. The javaScript and PHP page both work fine with the normal html form that is inserted right at the bottom of the page. I believe the problem lies in this piece of coding, because it isn;t picking up the "ch=" value NORMAL PAGE (FO...

Simulate Photoshop's Multiply in PHP with gd or ImageMagick

Having until now only used PHP's gd image library to resize, crop and greyscale images I'm currently struggling to find a way to simulate what happens when, in Photoshop, you place a coloured layer over a greyscale image and select 'multiply' from the layer effects menu. Or, as my old print lecturer would explain it, I need to make a duo...

Server IPC design issue

Hi, i have a design issue regarding sending user data from a mobile phone app to a server (Debian 5 LAMP). I need to send various details such as username , date of birth, customer order no. etc. These will be passed onto a C code app (always on process)running on the server. I am currently using named pipes for IPC between my external ...

PHP: Modifying prices to look presentable?

Hi everybody, We've all seen that stores have nice-looking pricing on their products; "1.99", "209.90" and so on. That's easily done as well if you enter prices manually, but l et's say that we would have a database which stores prices, that are daily updated according to currency changes. Prices are therefore automatically calculated...

PHP-Working with json

Iam working with json My application get string that encoded by json_encode(). Example : The string like this {"data":"1", "data":"2", "data":"3"} My app work well, But if browser give me something before i get my string like this: skdjksdjksdj{"data":"1", "data":"2", "data":"3"} My app will get all skdjksdjksdj{"data":"1", "data":...

php array pass by reference - assigning a duplicate value for the key gets discarded

Hi, I am sending a reference of an array variable which is initially empty. In the called function the array gets populated. function one() { $ret = array(); two($ret); pri nt_r($ret); } function two(&$res) { foreach($a as $b) { $id = $b->getid(); $txt = $b->gettxt(); $res[$id] = $txt; ...

Getting hostname or IP address of server in PHP

I basically need to create a anchor that will navigate to a different port on the server. For instance, our server is hosted on domain.com:555, we need a link to navigate to domain.com:777. The catch is that it's not always domain.com. We can expect the DNS to malfunction, in which case we will use ip address to navigate like xx.xx.xx.xx...

how to put a limit on a while mysql_array?

//check which faction members are online $sql = mysql_query("SELECT * FROM ".TBL_ACTIVE_USERS." WHERE faction=$userfaction_id ORDER BY timestamp DESC,username"); //no '' around var as it is an integer, so php doesn't expeect it to be string $numrows = mysql_numrows($sql);//gets number of members online if($numrows == 1){ echo 'You are t...

PHP Class to draw a competition playoff table in HTML

Hi all, I'm looking for a PHP class that would draw me (by fetching data from a mysql table) a competition playoff table in HTML similar to what they do on wikipedia (see under the "Bracket" section): http://en.wikipedia.org/wiki/2009%E2%80%9310_UEFA_Europa_League_knockout_phase Any input? Thanks ...

Batch include files while keeping the namespace clean

I've been using the following snippet to include multiple files: foreach(glob(APP_PATH."libs/*.php") as $path) { include $path; } The thing is, I don't want to have the $path variable available inside the included files. Fictitious solution: include unset($path); This would have worked if unset returned the value of the unsette...

Need help with PHP and MySQL

I have a table which has a column with numbers (no specific order). What would be the shortest way to insert the minimal number in this column into $min variable in PHP ? ...

Uploading multiple files per field and storing in a db with codeigniter

Hi, I have a form which uploads multiple file fields into a db using codeigniter. I need to be able to upload multiple files for each field. I understand that this could be achieved using some jquery magic, however, my problem is how do I intercept the multiple files and what is the best way to store them in my database? At the minute...