php

PHP initialize variable in __construct() vs declaration

i wonder if there is any difference between class TestClass { private $_var = "abc"; } vs class TestClass { private $_var; function __construct() { $this->_var = "abc"; } } i wonder if the latter is the preferred way/better practice? is there any functional difference? ...

PHP MYSQL, How to show records in four columns ,

Here is my code the records shows in four columns but if my records is blank it shows three balng images, any suggestions? $query = mysql_query("SELECT * from rbf_events_images where event_id='".$_GET['id']."'"); echo '<table border="1">'; if(count(mysql_num_rows($query)>0)): $tropentags='<tr>'; $troclosingtags='</tr>'; $formTags=""; $t...

Prevent or clear back history with form submission

Hi, I have a small quiz web application to deploy. Basically I have 2 pages, '1) Quiz page' and '2) Result page'. Upon submitting the Quiz form, it will generate the result on the result page for the user. However I need to prevent user from clicking on back button or keying in Backspace on the keyboard. I researched the use of 'locat...

How to select the correct id for the specific button pressed in dynamic table

I'm relatively new to jquery and cannot for the life of me get this to return the proper youtube id it just always returns the first one in the table. php. I load the youtube id from my database then display it in the table. require_once 'library/Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata_YouTube'); echo '<br/>'; echo '<table...

setting cookie and then redirection

hi! Ive designed a login form in php where the script sets a cookie and then redirects the the user to another page. But it shows the error Warning: Cannot modify header information - headers already sent by How can i overcome this? Please help. Thanks ...

Web Developer vs. Web Application Developer vs. Web Software Developer

Basically I want to know what each of those title means? What would be other names for people who develop websites using php and mysql? ...

How can I bootstrap Symfony into a standalone script?

(I hope 'bootstrap' is the correct term...) I have a Symfony 1.4 project in which I'm using a PHP script that mostly contains Javascript (I'm including this script with a simple <script src="/js/myStuff.js"></script> tag). I need to use some Symfony classes, helper methods, and variables from within the script (specifically the sfConfig...

Questions about Command Pattern (PHP)

i did up a minimalistic Command Pattern example in PHP after reading up about it. i have a few questions ... i'll like to know if what i did is right? or maybe too minimal, thus reducing the point of the command pattern interface ICommand { function execute($params); } class LoginCommand implements ICommand { function execute($par...

what's a good general purpose billing / recurring membership system?

something open source, or inexpensive... preferably in php, other languages will be considered. I'm looking mostly for clean code, a nice place to build out from... I don't need any CMS features. Thanks, -Eric ...

all data can show but "sEcho" value empty

if (postVar('sSearch') !="" ) { $sWhere = " WHERE Line LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' OR ". "Model LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' OR ". "NIK LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' "; } $sQuery = "SELECT Line, Model, NIK FROM...

search for string from array in another array

Hello, I have two arrays one with OS's such as Ubuntu and Windows and another with system templates like Ubuntu 5.3 blah blah and Windows XP SP2 blah blah and I need to extract the OS from the system templates array, however it is not always at the start, sometimes it is in the middle or at the end. So how could I loop through one array...

How to do error logging in php codeigniter?

Hi I am trying to do error logging in php codeigniter, I want to to know some bascis of error logging, 1. what are all the steps to be fallowed to log an error, 2. How an error logging file is created, 3. How to push the error message into log file( Incase, any error occurs) 4. How to do e-mail that error to the destina...

How to check whether a command can be executed?

I have an script that will show some compress options to the user (gzip, zip, and bzip). Since this is meant to run on both Linux & Windows and the Zlib library won't be available I have to compress any files by using Unix commands. Of course, if the script runs on Windows it probably won't have any of the nice command line compress tool...

PHP / ICAL / Google Calendar

I'm trying to get an ical feed working with Google Calendar and I just can't seem to get it right. I'm using the PHP iCalcreator class (http://www.kigkonsult.se/iCalcreator/index.php) and here's the code I'm using: <?php require_once APP_ROOT . '/lib/icalcreator.class.php'; $user = new User; $user->Get(1); $v = new vcalendar(); // cr...

"Touch" Web Page in iPhone SDK

Is there any way to "ping" or "touch" an external web page from an iPhone SDK? For example, if my user inputs 2 integer values, and I want a PHP script on my web server to intercept those variables, like so: http://www.example.com/script.php?var1=xxx&amp;var2=xxx&amp;udid=xxxxxxxxxxxx Is there any way to accomplish this "touch"? ...

How to get gettext work on IIS/PHP

I have Win XP + IIS + PHP (fastcgi) installed. I want to use gettext for multilanguage application. My php code (index.php): bindtextdomain('APP', './locale'); textdomain('APP'); And I have following directory structure: src\index.php src\locale\en\LC_MESSAGES\APP.mo src\locale\ru\LC_MESSAGES\APP.mo So, the code works, but only ...

Learning php. Hello world won't display using easyphp and writing in notepad++

<html> <!--HTML--> <head><title>a quick test</title></head> <body>a quick test</body> <p>javascript</p> <!--javascript--> <p><script> document.write("hello world") </script></p> <p>php</p> <!--php--> <?php Echo "hello world"; ?> </html> The Hello world works for javascript but not in php, what gives? Any suggestions or obvious e...

MySQL Query problem.

I can't seem to get this query to work can someone help me fix it. Here is the MySQL code. SELECT users.(user_id, pic, first_name, last_name, username), comments.(id, user_id, date_created) FROM users INNER JOIN comments ON users.user_id = comments.user_id WHERE comments.user_id = '$user_id' GROUP BY comments.date_created ...

php mysql if sum not working

trans_id trans_product trans_user trans_date trans_date2 trans_description trans_inventory 13 6 1 1278604284 1278547200 -1000 9 5 1 1278601462 1278547200 New Arrival 200 11 7 1 1278601743 1278547200 ...

Should a function be used in both static and object context

In my company's codebase, i see functions used in both static and object context. For e.g. a class A has a function b() which is called both using A::b() and/or object_of_type_A->b(). I know this throws an error if strict is turned on. But I wanted to know if this is a bad practice and if yes, then why? Thanks for any answers. Let me kn...