php

problem with class and var and __construct

i have this code $test = new test(); $test->var_test = array('one','two'); class test{ var $var_test = array(); function __construct(){ var_dump($this); } } the var_dump give me the $var_test in null why; i give it the one two values ...

How to include a file with relative path "upwards"

Hi I am trying to include a simple script like this : ini_set('include_path', ini_get('include_path').':'.dirname(__FILE__)); include('../configuration/live/database.php'); When i run the script (with sudo), PHP returns : PHP Warning: include(../configuration/live/database.php): failed to open stream: No such file or directory ...

Assign custom function return value and use in loop

I'm using the CodeIgniter framework with Smarty and use a custom Smarty function which returns config items: {ci_config name='sitemap'} This call returns an multidimensional array containing the websites sitemap: $config['sitemap'] = array('dashboard' => array('uri'=>'dashboard', 'titl...

Whether is it possible to indicate the printer to next page in php ?

I am using php language. I project i have the application to be print, It contain two pages. According to the data available the page content may be change, so printout of first page end and second page starting content not to be proper. So i want to know any other way is there, to separate the specific content to be printed from the...

Doing an SQL query in PHP that depends on a variable.

I´m trying to do the following query in PHP $sqlstr = mysql_query("SELECT * FROM sales where passport = $row['passport']"); if (mysql_numrows($sqlstr) != 0) { while ($row = mysql_fetch_array($sqlstr)) { echo $row['firstname']; }} How can I incorporate the value of $row['pass...

assign delete for each row using sql query dynamically not specifying the row NAME or ID

Hi Guys I want to assign delete for each row using sql query but not specifying the row NAME or ID, e.g.: $sql = "DELETE FROM $table WHERE Description1 = 'Description 10'"; ...must be dynamically maybe via row ID to delete correct row at any given time? Please let me know if you want me to eloborate more about the question above, than...

php search engines

Can anyone help me with a good list of php site search engines. I am thinking of implementing a google site search, but I would rather not pay for that and I would rather have as much control as I can over it. ...

Adding headings to table columns, and outputting a total from SQL

I have this code, $sqlstr = mysql_query( "SELECT * FROM sales where passport = '{$therecord['passport']}'"); if (mysql_numrows($sqlstr) != 0) { echo "<b>Sales for {$therecord['firstname']} {$therecord['lastname']}</b>"; while ($row = mysql_fetch_array($sqlstr)) { echo "<table><tr>"; echo "<td>{$row['product']...

Doing an SQL query in PHP where a field from a different table is referenced.

OK, In this query I am displaying the sales for a particular person, matching the passport number from the current form I am working on. What I want to do however, is to sum the total sales and display it, excluding records which have been marked as paid. I am having trouble because "paid" does not existent in the current form I am wo...

PHP: How to do caching?

Hi, So I'm looking to do caching for a forum I'm building and I want to understand the best method. I've been doing some reading and the way that the Zend Framework handles caching (here) explains the idea well, but there are a few things I'm not sure about. Let's say that I want to cache posts, should I simply "dump" the contents of t...

Adjusting PDF restrictions with PHP

I have a user uploading a PDF to my server, is it possible to adjust the PDF restrictions via PHP to not allow printing, copying, etc? Many thanks. ...

mysql_fetch_array for boolean fields?

I have a boolean field, which seems to be stored as 1 when true. When trying to grab that field in a while loop, I get the error: mysql_fetch_array() expects parameter 1 to be resource, boolean given Should a boolean be stored as "TRUE" instead of "1"? Otherwise, why would I be getting this error? edit: My code: $sqltotal = mysql_...

PHP: get number of days between two dates in format YYYY-MM-DD

Possible Duplicate: How to find number of days between two dates using php Is there a quick and easy way to calculate the difference in days between two date strings in this format (YYYY-MM-DD) with PHP (not MySQL)? ...

parsing user-typed Full Text Search queries into WHERE clause of MySQL using PHP

I want to convert user typed FTS queries in to MySQL's WHERE clause. So the functionality will be something like Gmail's search. So users will be able to type: from:me AND (to:john OR to:jenny) dinner Although I don't think it is important, the table structure will be something like: Message - id - from - to - title - descriptio...

Why browser is trying to download my php script file?

Hi there everyone. Just a quick one - I wrote a php script recently that dynamically creates XML file using API DOM. So I'm using this at the beginning: $dom = new DOMDocument('1.0', 'UTF-8'); And at the end it looks like this: $server = $_SERVER['DOCUMENT_ROOT']; $path_to_xml = "$server/project/file.xml"; file_put_contents($path_to...

Loop Code Optimization

How can I optimize the following code , I Need to run 3 sets of loops like this: for($i=1;$i<=$count-1;$i++){ for($j=$i+1;$j<=$count;$j++){ // do some query use $i and $j } } for($i=1;$i<=$count-2;$i++){ for($j=$i+1;$j<=$count-1;$j++){ for($k=$j+1;$k<=$count;$k++){ // do some query use $i and $j and $k ...

Is there any Offline Map Libraries for PHP?

Hello guys, is there any offline map libraries that can be used from PHP? I want to make an application which displays all data position of stations (with latitude and longitude) on a map. But the user doesn't want this application connect to internet, so I can't use Google Maps as a solution. Do you know any offline map libraries th...

How to find the transaction is settled/Unsettled in Authorize.net?

Hello there, How Can I find whether the transaction made by user is settled or Unsettled in the authorize.net.I am using AIM. I want to get through coding.When the transaction is completed and I cant find transaction status.But I want to get whether it goes for settled or unsettled transaction. Thanks in advance. ...

How to use the concatenation feature of SmartOptimizer PHP library?

Hi, I am using the SmartOptimizer(previously named as JSmart) PHP library to improve my site performance. This library will enhance our website performance by minifying, compressing, concatenating, and caching the JS and CSS files used in our website. You can check the details of this library here. I want to use the concatenation feat...

Can't get Ajax works

Hello, I have a problem with Ajax. I'm totally noob with Ajax, and I apologize for such a stupid question. I have a list of elements (loaded by a db) that I want to manage, i.e. Remove, Modify their name..; I want to use ajax to change db and the list. But I want that the page is modified only AFTER the db has been modified. I can mo...