php5

PHP - Assigning values within if statements

Hi Guys, I read the other day that assigning values within if statements isn't such a great idea. To be honest i actually use this quite a lot e.g. if(isset($_POST) && $post = $_POST) { print_r($post) } Any idea why that isn't optimal? Thanks in advance! ...

Unicode in MS Access using ODBC(PHP)

I am trying to insert , update some data into MS Access database using ODBC , that data came from $string=html_entity_decode($unicodedata, ENT_NOQUOTES,'UTF-8')."\n"; that look like this " ബാലകàµà´¯à´·àµà´£à´¨àµ*à´¨à ",actual data needed like this പ്രമോദ്കുമാര്‍, i have worked on this with Mysql , which has connection collatio...

IDE for CodeIgnitor framework

Hi everyone i am going to use codeignitor php framework to develop web application. now i am confused about using IDE. I do not know which IDE is best suitable for codeingitor framework. is there any one who can help me in this regard. thanks. ...

urlencode/urldecode problem

I am selecting data from a MySql database and doing the following echo "<input type=\"text\" name=\"distadd1\" id=\"distadd1\" class=\"textbox\" value=". urlencode($row['ADD1']). " >"; however the value is being displayed as follows Department+of+Planning+%26+Development. how do i remove the + and %26 ...

preg match not reading content between table

preg_match_all('|(.*?)|', $read, $foo, PREG_SET_ORDER); print_r($foo); output as just Array ( ) Where i made mistake See guys , Actually i want to grab the exact details from this URL i want to pick this details from this URL 08:35 9W5048 TORONTO EXPECTED 1358 Terminal three So i tried this snippet , but...

Create dropdown filter options for a column when you create a .csv file from php

Does anybody know how to create drop down/ filter options for a particular column when you create a .csv file with php. I am generating a .csv template and want to give the option of choosing only the filter values as cell data for that column. ...

Dynamic functions, variable inputs

Right now, lets say I have code much like this... $some_var=returnsUserInput(); function funcA($a) {...} function funcB($a,$b) {...} function funcC($a,$b,$c) {...} $list[functionA] = "funcA"; $list[functionB] = "funcB"; $list[functionC] = "funcC"; $temp_call = list[$some_var]; //Not sure how to do this below, just an example to show...

PHP5 Certification - What’s the answer?

elloo, i've done some more php 5 certification mock exam questions however i cannot be sure that i'm right with some of the questions so i have decided to post them here. my answers are below each question if i'm wrong please feel free to criticise. many thanks in advance Q2. The _____ keyword is used to indicate an incomplete class o...

PHP: cURL and keep track of all redirections

I'm looking to cURL a URL and keep track of each individual URL it goes through. For some reason I am unable to accomplish this without doing recursive cURL calls which is not ideal. Perhaps I am missing some easy option. Thoughts? $url = "some url with redirects"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ...

Input specific data into database using CURL

Hello, I am new to using CURL, and a novice PHP coder. I would like to take specific elements on a web page (that change via AJAX) and input them into a databse using CURL. As of now, I can write a text file of a web page using CURL, but I dont really know where to go next. Any help would really be appreciated! ...

How to echo out info from MySQL table in PHP when sessions are being used.

Hello, I am using sessions to pass user information from one page to another. However, I think I may be using the wrong concept for my particular need. Here is what I'm trying to do: When a user logs in, the form action is sent to login.php, which I've provided below: login.php $loginemail = $_POST['loginemail']; $log...

Amazon Product API with PHP

Hi All, I'm trying to integrate Amazon Product API into my website and came across several posts that helped me construct the URL. Only problem is when I execute the code below I get the following error. Am I doing something wrong? Internal Server Error The server encountered an internal error or misconfiguration and was unable...

PHP - usort(): Array was modified by the user comparison function

I have a web application that runs fine on our Linux servers but when running on Mac OS with the Zend Community Edition Server using PHP 5.3 we get the error "usort(): Array was modified by the user comparison function " every time a page loads for the first time (it takes about 2 minutes for a page to tick over and load, on the linux se...

PHP Can't Connect to MS SQL Express 2008

Hi all, I'm struggling to connect to my MS SQL Express 2008 edition from my PHP files, but it seems virtually impossible. I've found several guides/notes on teh intarweb solving the issues, but none of these have helped me any further. I've taken a script from another site and entered my database information, but I still get errors: ...

how to connect to another db with doctrine on zend framework

I use Zend Framework 1.10 with integration on Doctrine 1.2. in the application.ini file, i declare the 'dsn' to connect to database. in my application i need to connect to another db to run some queries. how can i do it ? i only need to run query , i don't want to generate all the Models for this DB. right now in the bootstrap.php...

Why PHP Functions arent True Methods ?

Why all PHP Functions for (Array , String , Database etc. handling) arent True OOP Methods. We can just call them like 'static' methods anywhere. PHP5 and PHP6 advertise themselves as True OOP Languages , but what about Encapsulation then ? I think In a proper World all Array methods should belong to Array Class and String Methods should...

How do I integrate date check function in single mysql query??

this is my current function: $result = $db->sql_query("SELECT * FROM data1,data2,data3,data4 WHERE person='" .$name. "'"); $row = $db->sql_fetchrow($result); $day = $row['regtime']; $days = (strtotime(date("Y-m-d")) - strtotime($row['regtime'])) / (60 * 60 * 24); if($row > 0 && $days < 15){ $row = ['name']; $row = ['age']; //etc bu...

Free PHP5.3 Hosting

Is there anyone who knows a good free PHP 5.3 hosting? I've searched for long but I couldn't reach to find anything till now. Hope that someone can help. ...

PHP script for downloading files with utf-8 characters in the names

Hi, I have files named in foreign characters, that I have uploaded after encoding the names using utf8_encode(). But now, when I m trying to download them using readfile(), they give "not found" errors. I have pasted the code below. I think the problem lies with some header I have defined. Can anyone tell me what's the problem? ======...

parse html site with php dom/xpath problem

I want to parse one site. Structure of the table: inside many (if site is being updated number of is not the same). inside this we have (with class="a" and second class="b" and thrid class="c" and fourth class="n" only free space) and (with class="d"). Example with this structure: <table> <tbody> <tr> <td class="a"></td> </tr>...