php

drop down and post data to data base

This is a form which retrieves data from db and displays them in table. At the beginning of each row there will be a check box. If there are 10 rows fetched, I ii check 5 rows and insert them in to diff db but here when, I click drop down box data is getting in to db automatically,bcoz I use onchange event. Any alternative to prevent thi...

Directional Map Search

Hello, I am trying so write a bit of code that will search for a given point on a map, but in a given arc of a compass bearing. e.g. 45 degress (north-east), 20 degrees either side. So far I have got a SQL command that will give me the results in a given radius, need some help on how to filter it to a direction. SELECT * FROM (SELECT ...

How to create manual php header?

hello i would like to know how would it be possible to create a manual php header example header("Content-Disposition: form-data; name=\"$fieldname\"; filename=\"$filename\"); instead of using that i would like to create manual it as $senddata = "Content-Disposition: form-data; name=\"$fieldname\"; filename=\"$filename\"".$nn; ...

adding remote files to a zip file

Is there a way to add files to a zip file from another server with php's zip extension? ie. addFile(array('localfile.txt,'http://www.domain.com/remotefile.txt')) (that obviously does not work) I suppose I can download the files to a temporal folder and then add them to the zip file, but I was looking for a more automated solution or a f...

Cross domains sessions - shared shopping cart cross domains

Hi, we are solving the problem with eshop (php, mysql). The client want to have the same eshop on two domains with shared shopping cart. In the shop customer can do the shopping without users account (can't be logged in). And there is the problem, how to make the shared shopping cart cross domain. The data from cart is stored in sessi...

Registration during content creation in Drupal?

Is there an easy way to allow a user to register as he creates content type. E.g. Let's say there is a content type called "listing". When the user clicks to on a link to create it, and he's not logged in, I want a "register" box to appear ABOVE THE CONTENT CREATION area, where the user can enter his normal registration details. Is this ...

"Undefined index" when quoting array key

I have a form in index.php <?php echo '<form action="update_act.php" method="POST">'; echo '<input type="submit" name="'.$row['act_name'].'" value="edit"> echo </form> ?> Here $row['act_name'] is a value fetched from database. My update_act.php file is <?php echo "Old Activity Name : ".$_POST['$row[\'act_name\']']; ?> B...

PHP ORM's, multiple tables and efficiency

Let's say I have a data mapper function that aggregates multiple tables and generates an object instance from that data. The mapper has a typical save() method which delegates to update/insert. When the mapper executes save - ideally it isolates object fields that have been modified, thus preventing the code from blanket bombing the da...

cakephp and SQL_CALC_FOUND_ROWS

I am trying to add the SQL_CALC_FOUND_ROWS into a query (Please note this isn't for pagination) please note I am trying to add this to a cakePHP query the code I currently have is below: return $this->find('all', array( 'conditions' => $conditions, 'fields'=>array('SQL_CALC_FOUND_ROWS','Category.*','COUN...

exec('unzip gallery.zip',$return); php

can any one please let me know, why i could not get result for the php function exec('unzip gallery.zip',$return); print_r($return); ...

PHP find if file data is an image

Imagine I have some file data in a variable $data. I need to determine whether it is an image or not. No need for details such as corrupt images etc. Firs thought would be getting the file mime type by looking at the magic number and then see whether "image" is in the mime type. No such luck, even if I have a "file extension to mime ty...

gzinflate erroring

Well, I'm trying to gzdeflate my code to perform some very low level encryption for distribution, to use with eval(gzinflate('deflated_code')); However whenever I try to inflate the deflated string, it outputs an error. For example: echo(gzdeflate('test')); outputs +I-.� But when I try to echo(gzinflate('+I-.�')); it only outputs War...

is OAuth required in Facebook Graph API ?

Hello i have a problem .. i want to get all the feeds from a facebook page using fb graph API without OAuth but i have a problem https://graph.facebook.com/[page ID]/feed i get the following response { "error": { "type": "OAuthAccessTokenException", "message": "An access token is required to request this resource." ...

Displaying csv content in key value format and storing in a database

Hi, I have used following code for retrieving content from a csv file. <?php $fo = fopen("records.csv", "r+"); while(!feof($fo)) { $contents[] = fgetcsv($fo,0,','); } print_r($contents); fclose($fo); ?> It returns me following: Array ( [0] => Array ( [0] => Search Transactions Results ) [1] => Array ( [0] => Transaction ...

Change XML node element value in PHP and save file.

<testimonials> <testimonial id="4c050652f0c3e"> <nimi>John</nimi> <email>[email protected]</email> <text>Some text</text> <active>1</active> </testimonial> <testimonial id="4c05085e1cd4f"> <name>ats</name> <email>[email protected]</email> <text>Great site!</text> <act...

send 1000 mail or more with PHP

How can i send 1 mail to 1000 person with php, and not to wait 10 hours? It's possible to set an cronjob from php? sorry my English! and thanks a lot ...

regular expression search and replace

Hello This is some code <br /> <br /> <br /> <br /> <br /> <br /> but I want replace <br /> fourth with <hr /> And this output <br /> <br /> <br /> <hr /> <br /> <br /> Please help me ...

PHP job interview questions?

Hello, I'm going to attend a job interview on Friday this week. It's an interview for a position of PHP programmer (the company doesn't do websites so I guess they just need somebody to administer their website). I'm expecting there will be more people at the interview and that we will be given some simple questions or tasks in PHP so ...

adding up value of array and getting the average

I have an array that looks similar to this, [4] => Common_Model Object ( [id] => 4 [name] => [date_created] => [last_updated] => [user_id_updated] => [_table] => [_aliases] => Array ( [id] => 4 [name] => [date_c...

Present data get from tcp on webpage without refreshing entire page?

My php script communicates over TCP with C server, is there a way to present data obtained from the server while it does not refresh the entire page, so the data refer to a ajax script? ...