php

How do I hook into an event triggered once a MySQL query is true?

How does one create a PHP script that checks the MySQL row consistently and if a set query is matched, it starts an event, such as sending an email? For example, on query match Fire start email: To: [email protected] From: [email protected] Subject: Set query met, auto email complete. It would be around MySQL5. I'm stuck on this. Am I best to ...

Wordpress, filter to change the search term?

Hi, I was wondering what the filter was to change the search term in Wordpress? For example, if someone types in xxx, how could I change that to yyy before it goes into the wordpress search engine? Cheers. ...

Php / MySQL search function: there must be an easier way of achieving this?

//lets get the auto name set $accepted = 0; $sql = mysql_query("SELECT * FROM ".TBL_FACTIONS." WHERE f_name='no_name'"); $numrows = mysql_num_rows($sql); //default name 1 if($numrows == 0){ $auto_name = 'no_name'; $accepted = 1;} //default name 2 if ($accepted == 0){ $sql = mysql_query("SELECT * FROM ".TBL_FACTIONS." WHERE f_name='no_na...

facebook set_status facebook api

I have $facebook->api_client->status_set('is the Eagle has landed.',''); as part of a test page, and i get errors Call to undefined method FacebookRestClient::status_set() please help, thank you ...

LDAP connection with PHP web-application

We have a web-application, hosted externally. One client now asks for a SSO (single sign on) solution and suggested a LDAP link with our web-application. Our website uses PHP. We prefer not to use something like VPN, but we have no experience at all with this stuff. Is it possible to use Windows authentication and somehow automatically...

Any way to avoid loading unused classes for a non-oo app?

My application uses a 'central' page controller that grabs a bunch of files (I hesitate to say libraries) each containing a few related classes, using require_once, before fetching the request. As in: require_once (dir_lib . 'db.php'); require_once (dir_lib . 'uuid.php'); require_once (dir_lib . 'data.php'); ...

Drupal - custom region in custom content type

Hi, I'm having big troubles at displaying blocks on a custom content page only. So here's the problem; I have block X that I want to display on a node that is of a custom content type Y. I do not want this block to show on every page, only those that are of a given content type. If I define custom region Z on my custom content page te...

Trouble creating a Joomla module

When I activate the module I just created and navigate to the page its on, the page is completely blank, no errors (even in debug mode). Its doing it right away at the line: defined('_JEXEC') or die('Direct Access to this location is not allowed.'); I've removed that for testing purposes and it then dies at the next line: require_onc...

pass data to $_POST php

Hi, How can I pass a value/variable to $_POST? Im not getting all data to my php function. So i just figured out to pass them explicitly. Can anyone tell me how this is done? ...

php string variable containing as input for array function

Why this does not work? $stringhaha =" 1 => General, 2 => Business, 3 => Entertainment, 4 => Health, 5 => Politics, 6 => Sci/Tech, 7 => Sports, 8 => News"; $all_categories = array($stringhaha); print_r($all_categories); (will give an array with 1 item.) While this works: If I include ...

fetch data from elements with same id in a HTML document

I am using PHP DOMDocument class to parse the HTML file, and using the code, $dom =new DOMDocument(); @$dom->loadHTMLFile($file_path); $dom->getElementById("my_id") to fetch the data of the element with the ID "my_id", but the problem is the HTML document is containing multiple elements with same ID, and i want the data in all that el...

uploadify s3 404

Hi. I have made use of the jQuery uploadify example with Amazon S3 and seem to be getting an error 404. Where is this error coming from... In the example it states that all you need to do is change the details and obviously replace it with your credentials, (AWS key, AWS Secret and bucket name) which has been done, but for some reason ...

PHP move_uploaded_file() error ?

I using following code and it is successfully uploading files on my local machine. It is showing "Successfully uploaded" on my local machine. // Upload file $moved = move_uploaded_file($_FILES["file"]["tmp_name"], "images/" . "myFile.txt" ); if( $moved ) { echo "Successfully uploaded"; } else { echo "Not uploaded"; } But...

extract first 3 items in an array

$array = array('item1', 'item2', 'item3', 'item4', 'item5'); here i want to extract only the first three items in the array, and then $implodes = implode(';', $array); echo $implodes; which should output item1;item2;item3 $i=0; $new = array(); foreach($array as $arr) { $i++; if($i <= 3) { $new[] = $arr; } } doesn't ...

Zend_Captcha_Image generates empty captcha :(

Hi, i have strange problem when using Zend_Captcha_Image. Sometimes it generate empty captcha, only with lines and dots, but with no text :( EDIT: It happens for every 4-10 pageview/image refresh. Look here for registration form here This only happens on one server. At another with same OS it is without any problem. Anybody with sam...

Why this code not generate in my PC (PHP)????

Hi everyone When I write <?=?> in my PC it's not working,but it's work in another PC !!! why ??? :( for example : <?php $courses = CourseManager::findAll(); ?> <h3>Course List</h3> <table> <tr><th>Name</th></tr> <?php foreach ($courses as $c){ ?> <tr> <td><?=$c->getName()?></td></tr> <?php } ?> </table> or ...

why backslash is added when I pass the value from Jquery to PHP?

When I pass a value from Jquery (For Example test's name) in post method.When I get the the same value in PHP and return it I got like this test\'s name.I don't know why? I used the encode URI also.Thanks in advance. ...

PHP RegEx to get form values

If you're given a form in a string format like: <input type="hidden" id="thisID" value="Text Value" /> How can you get the value "Text Value"? Also with: <select name="thisSelect" size="1"> <option value="one">One</option> <option value="two" selected>Two</option <option value="three">Three</option> </select> How can you get ...

SQL time period query

I need to select from a table all rows that have date_added between CURDATE() and 6 weeks ago. Help please. ...

PHP in PHP, Problem with dynamic forms

hi there, I'm a newbee I've got a little problem with my php-script. I try to generate dynamic formulars with php. which works very good. the problem is, I want my data to be send to another funcion in another php-script. I gues its a problem with the syntax: <?php .... <form action=\"<?php myfunction() ?>\" ... > ... ?> When I used ...