• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: sql query using K2 item id

sql query using K2 item id 12 years 8 months ago #18669

  • info4261
  • info4261's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hello,

Can somebody help me with a sql query.

So i created a button in my article that points to the form. I want the article id in the sql query so that the subject field is filled by the article titel.

i have this so far, but it gives me an sql injection error.

$database->setQuery("SELECT title FROM dup9q_users");
$data = $database->loadObjectList();//we load the usernames

foreach($fields as $i=>$field){
if($field->name=='select1'){//cycle through the fields, and find our select box field
$string = array();
if(!empty($data)){
foreach($data as $data_row){
//prepare the default syntax which will be value1|label1,value2|label2
$string[] = $data_row->username.'|'.$data_row->username;
}
}
$string = implode(',',$string);
$fields[$i]->default_value = $string;
}
}
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!