Php plugin list - run PHP code

Status
Not open for further replies.

georgie

Member
Hello

I wish to execute PHP code with a button, thanks to the great plugin php! But I can not retrieve the id of the selected record.

Php well executed this query:

$db =& JFactory::getDBO();
$query = " update apr set valide='yes' ";
$db->setQuery($query);
$db->execute();

But I can not seem to apply only to the selected record !

Can you help me!

THX
 
Hello, you need to catch the rowid of item you selected (or item attached on you php button) and fix a WHERE condition in your query, otherwise your update will be applied on all datas of table apr.
Try this:


//Catch your selected data

$IDinput = '{rowid}';

//Create connection to database

$db =& JFactory::getDBO();

//SQL query - update table apr, set field 'value' to yes if line is selected

$query = " update apr set valide='yes' where id IN('.$IDinput.')";

$db->setQuery($query);

$db->execute();
 
Hi ! Thank you but it doesn't run. No bug, query seems be executed, but without correct catch of the rowid !

Any idea ? I am on Joomla 3.3.0 !
 
Status
Not open for further replies.

Members online

No members online now.
Back
Top