php

PHP Preg (regex) extracting last value from a string? not as simple as I thought

I'm trying to use PHP preg to extract the integer at the end of the string below, in the example its "4", but could be any number coming after "INBOX/", also the "[email protected]" is a variable so it could be any address STRING I'M EXTRACTING FROM: /m/[email protected]/folder/INBOX/4 /STRING I've been going in c...

Select List with a NULL that gets committed in SQL

I have a select list like the following inside of a form. <select name="0[voicemail]" > <option value="" selected="selected"></option> <option value="800">800</option> <option value="801">801</option> <option value="802">802</option> <option value="803">803</option> <option value="805">805</option> <option value="807">807</option> <opt...

adodb, pdo or other, I want autoExecute

I used to use PEAR MDB2 and one of the things I loved was the autoExecute() It really cut down on code. But's it's a pain having to get MDB2 enabled on some hosted servers. I'd like to use either PDO or just include some class file. It looks like adodb has autoExecute too http://phplens.com/lens/adodb/docs-adodb.htm#autoexecute Is th...

PHP DOM append child with new line

Hello all, My name Rithy. I don't know how to add new line before appending a new node or element in the xml. My php: $dom = new DOMDocument(); $dom->formatOutput = true; $dom->preserveWhiteSpace = true; $dom->load($xml_file); $body = $dom->getElementsByTagName('body')->item(0); $newelement_seg = $dom->createElement('seg'); $da...

How to move from Procedural oriented programming to Object Oriented Programming in PHP

Hi I am working with PHP for last 1.5+ years with procedural oriented programming. I like to move from procedural oriented code to object oriented code. But i am struggling with this. I don't know how to start and where to start. I having basic knowledge of OOP. But i don't have any idea on how to implement that. I hope most of the pe...

How can I retrieve a picture from my database in PHP?

I've stored an image file on my local drive and the path to that image in my database. How can I retrieve the image for displaying it in PHP? ...

How to not die?

I want something like this: or function() { echo mysql_error().'<br>'; } // doesn't work Instead of: or die(mysql_error()); I want to continue the execution of the script, not to "die". Can't I use the anonymous function that way? I just woudn't like to name it. EDIT/TIP: For creating anonymous functions, there's a lambda-style f...

use Gtfs with php

Can anybody say how to use google transitfeed with php is there any sample coding is there ...

Help with PHP preg_replace() REGEX for MP3 URLs

Ive looked around quite a bit for a regex to help me find a anchor tag with an mp3 as the href. I would like first to get a regex which will locate this pattern so i can replace those links with a player and next i need to extract the link out of the href. I hardly understand how to create or use a regex so any help to accomplish this w...

Highly filtered search based on multiple conditions

I have two tables in a restaurant search done in php. All the information about the restaurant type, facilities, cuisines are in entered to Table2 -'stack' with reference to their restuarant id in the table 1. How do i run a query so that i can get all the restaurant that serve chineese and also serves dinner and also have parking? This...

how to call a javascript function from my controller?

Hi I have a form in my view page on submit a function in a controller called function Login() is called This is my Login function function Login() { $EmailId = $this->input->post('mailId'); $Password = $this->input->post('password'); $res=$this->friendsmodel->CheckLogin($EmailId,$Password); if($res==true) ...

How to zip 100 mb files during (before) upload so that upload speed can be increased?

Possible Duplicate: HTML Compress File Upload? I have complains from client that my website is taking more time to upload the 100 MB time (I know it bound to take more time because of this size), hence I am planning to upload files such that they get zipped before upload and gets uploaded to desired location and then gets unzi...

Reading Google search results using PHP ?

Is der any method to read the Google search result and display it own style . I want to read the contents of Google search results after users search for query will display only the .PDF files for the search queries is it possible to do with PHP ? ...

sql injection in php

my query written in php is: $sql="SELECT * FROM ".TABLE_PREFIX."login WHERE username ='".$username."' AND password='".$password."'"; $res_id = mysql_query($sql); $num_rows = mysql_num_rows($res_id); echo $num_rows; When i enter a valid user name and password from a form it works ok. When i input some sql injection code the que...

How to call winapi functions from PHP?

1) How to call winapi functions from PHP? 2) How to load any dll file and call functions from it? Platform: ms windows, php5 php_w32api extension is not avalaible. Maybe there is solution using COM objects? ...

PHP/Flash integration inconsistencies

Hi guys, I am having some consistency problems with my flash application, when I echo out variables for flash to get, it doesn't always pick up what PHP is sending, it seems to vary from PC to PC. I am getting info from a database, and I need to pass it to flash, say for instance I need to send through 5 variables $uid,$name,$points,$f...

Menus not displayed properly in page containing swf file(amcharts).

Hi, I have different pages containing charts (swf file).These charts are built using amcharts. In the header there is a menu containing link to different pages. If in a page there is a content followed by chart then menus are displayed correctly as can be seen from the following image But if a page contains chart only then only some ...

problem in showing all files of a directory

hey guys im looking for a way to show all mp3 files in a directory this is my code to get that : if ($handle = opendir($dirPath)) { while (false !== ($file = readdir($handle))) { if ($file = ".mp3" && $file = "..") { echo ' <track> <location>'.$dirPath.$file.'</location> ...

Setting the value of a checkbox based on what is selected in a list

I am working in the confines of a CMS system, which defines certain fields which can be used to make forms for use within the application in PHP. The list function has the signature: function inputBasicList ($id,$value = "",$list = array(), $displayName = NULL, $displayLabel = true) I use it thusly: $theinput = new inputBasicList("t...

Setting multiple fields in a database, from just one field...

I am working in the confines of a CMS system, which defines certain fields which can be used to make forms for use within the application in PHP. I am making use of the inputSmartSearch field, which is basically similar to Google suggest. It allows me to define an SQL query, and then displays records that match as I type in my search. ...