Looking for an explanation on ajrequest issue [SOLVED] - Joomla! Forum - community, help and support
hello
here s problem ve got , solved. problem not sure on happened... here's problem , solution ve found, great if give me explanation on why not working. ( know should use jinput
)
i have 2 template pages (in tpl directory) of view. 1 create office entry in database (default) , other 1 edit view (edit). they share same model file
for each office, there photo. function, placed in model gets image, displayed in edit page .
with function below. works, , display photo.
the problem is, kills default page, if not displaying photo there, giving me 1064 error . way ve found rewrite function follow
with syntax, works correctly. idea on ? id variable not exist int default page ? 'if jrequest' ? going if id variable exists ?
tks answers
here s problem ve got , solved. problem not sure on happened... here's problem , solution ve found, great if give me explanation on why not working. ( know should use jinput

i have 2 template pages (in tpl directory) of view. 1 create office entry in database (default) , other 1 edit view (edit). they share same model file
for each office, there photo. function, placed in model gets image, displayed in edit page .
with function below. works, , display photo.
code: select all
function getofficephoto(){
$id = jrequest::getvar('id');
$query = "select * #__locplantes_offices x ".
"left join #__locplantes_work y on x.id = y.fk_office_id ".
"where y.id = ".$id;
$this->db->setquery($query);
$officephoto = $this->db->loadobjectlist();
return $officephoto;
}
the problem is, kills default page, if not displaying photo there, giving me 1064 error . way ve found rewrite function follow
code: select all
function getofficephoto(){
if (jrequest::getvar('id')){
$query = "select * #__locplantes_offices x ".
"left join #__locplantes_work y on x.id = y.fk_office_id ".
"where y.id = ".jrequest::getvar('id');
$this->db->setquery($query);
$officephoto = $this->db->loadassoc();
return $officephoto;
}
}
with syntax, works correctly. idea on ? id variable not exist int default page ? 'if jrequest' ? going if id variable exists ?
tks answers
not soon, should first choise long time.schlogo wrote:( know should use jinput)
goes if block if not 0 or false, right.schlogo wrote:what 'if jrequest' ? going if id variable exists ?
right, value not exist , not issue of error, 1064 syntax error in sql statement.schlogo wrote:with syntax, works correctly. idea on ? id variable not exist int default page ?
id int value, you're requesting string, getvar() default value "null" causes sql error.
since id int should use getint(), default value of getint "0" , should not give sql error.
Comments
Post a Comment