php

Problem in converting from html to pdf

I'm currently on a php project in which the pdf files can be able download generated from (html content) server side backend. I've already tested html2pdf librairy and I've found it is not a right choice for me because it doesn't support utf-8 format. When I tried with utf8_decode(), described in their documentation, the problem is just ...

PDT installed but PHP Perspective is missing

I have installed PDT 2.1 but i can't switch to the PHP Perspective, any ideas? ...

Equivalent of SimpleTest "partial mocks" in PHPUnit?

I'm trying to migrate a bunch of tests from SimpleTest to PHPUnit and I was wondering if there is an equivalent for SimpleTest's partial mocks. Update: I can't seem to find anything in the docs which suggests that this feature is available, but it occurred to me that I could just use a subclass. Is this a good or bad idea? class StuffD...

creaing a registration form in php

Hi I have created a registration form(sample one fro trial). But if i dont give the value in the field,still it submit. So I need to validate the field using java script and have to give a message"please fill the form" if the field is kept empty. this is my code <html> <body> <form name="reg1" action="try.php" method="post"> <table> <t...

How to find undefined variables in PHP script

Suppose we have following function in PHP: public function testSomething() { $name = perform_sql_query("SELECT name FROM table WHERE id = $entity_id;"); assert($name == "some_name"); } Query is syntactically correct, but since $entity_id is undefined - query will always search for 'id = 0', which is semantically incorrect. I ...

Get rowid from Mysql

Hi friends i develop a project, in that i display the values from mysql database using PHP , in that i need to set a unique id[Not manually] for each row that i fetched from database.Can anyone help me please. Thanks in Advance. ...

Open Flash Chart and Zend Framework Autoloader: class not found

I'm trying to upgrade the charts in my zend framework based website to the open flash chart 2 (version: kvasir) library. It used to work just fine with older versions. However, using the new version, when I try to create e.g. lines, I get error messages such as Warning: include(line\hollow.php) [function.include]: failed to open stream:...

Compiling PHP 5.1.6 with PDO MySQL

I originally asked this question on ServerFault and haven't got any response and I figure it's programming related so, here goes... A while ago a large client of ours moved to a single hosting provider who spec'd out a software environment which would be consistent accross all the live servers. Amongs other things this includes Apach...

Making all PHP file output pass through a "filter file" before being displayed

Is there any way for all my PHP and/or HTML file output to be "filtered" before being displayed in the browser? I figured that I could pass it through a global function before it is displayed but I'm stuck on the implementation. Please help. If there is a better way to achieve the same result, I'd be happy to know. Thanks. ...

Insert array values into database

I have a form that lists module id and also sub_module_id, for example ADMIN === is parent module ID users=== sub module id here admin appears in the menu and users inside admin now inside the form i have used checkbox like []Admin []Users for parent module ID admin <input id='module_permission[]' onclick=\"selectall()...

Is CodeIgniter a wise choice for large applications?

Hi, I keep on reading how great codeigniter is from a development standpoint. And I am sure that using the framework will make the development process quicker. But the question I ask myself is, will there be a difference to a individually made framework, which caters to your needs? Is CI, despite the advertised small footprint, going ...

Is the PHP file instantiated on every AJAX call?

I was just wondering how the PHP is behaving in the background. Say I have a PHP which creates an array and populates it with names. $names = Array("Anna", "Jackson" .... "Owen"); Then I have a input field which will send the value on every keypress to the PHP, to check for names containing the value. Will the array be created on e...

What security issues should I look out for in PHP

I just starting out learning PHP, I've been developing web apps in ASP.Net for a long while. I was wondering if there are any PHP specific security mistakes that I should be looking out for. So, my question is what are the top security tips that every PHP developer should know. Please keep it to one tip per answer so people can vote up...

PHP Fatal error: Uncaught exception 'Exception' problem

I have a php script that connects to an api and posts our information to their systems, but when its trying to connect it throws an exception error, and I cant for the life of me work out why. Whats interesting is that if I send it to a simple php script which just grabs the IP then it works, but if I send it to the API it doesnt :( Th...

Clean OO-structure vs. SQL performance

When programming in PHP I always try to create meaningful 'models' (classes) that correspond to tables in the database. I often encounter the following problem: Assuming that I've created a database with two tables: authors and blogs, which both have a corresponding model in my application. Let's say I want to print all the blogs along...

Is mysql_num_rows efficient and/or standard practice?

A while ago I was poking around with SQLite, trying to port some of my sites to use it instead of MySQL. I got hung up on the lack of a function to count results, like PHP's mysql_num_rows(). After searching a little I discovered this mail list, which says (as I understand it) that SQLite doesn't have that functionality because it's inef...

What's the best way to implement user's preferences in this PHP app?

I have a smaller web app that republishes content from one social source to another. Users have, let's say 5 options for how to filter that content. Their prefs are stored in my user DB as 1 or 0 markers. When I do my major "publish" action hourly, what's the best way to break up my code to implement these preferences? To make it more c...

If else condition not calling a function in PHP

if($process->g_User() && $process->g_Pass()){ if($process->LdapConn()){ if($process->LdapBind()){ return 'google'; }else{ procLogin(); } } } If my condition fails, it must call the procLogin() function but its not calling... the ProcLogin has just an ec...

Problem in fomating date, when using date function with strtotime function ..

Hi, I am using date function along with strtotime function to format the date. Ex: <?php $input_date = '03-JUL-09 14:53'; $formatted_date = date("Y-m-d H:i:s", strtotime($input_date)); echo $formatted_date; ?> Gives me a expected output: 2009-07-03 14:53:00 while if the input is changed to(I am removing the minute part)- <?php...

WordPress oddity with broken images (part 1)

Can you tell me your opinion of this, and possibly see if you can recreate it: Currently, the $post->post_content variable contains: "before <img src="/path/to/valid_img.gif" /> after" This code placed at the top of the theme header.php... ------ Code -------- 1: $str = $post->post_content; 2: assert( isset( $str ) ); 3:...