Hello,
I am doing a php validation in a radio button, with this code:
$db = JFactory::getDbo();
$myrowid = '{rowid}';
$myQuery = 'SELECT id2 FROM devedorestotais4 WHERE id={$myrowid}';
$db->setQuery($myQuery);
$dt = $db->loadResult();
if($dt == '20' ){
return true;
}
else{
return false;
}
and i have this table "devedorestotais4":
id id2
1 21
2 20
3 00
4 00
5 00
6 21
When I try to edit the id=2, the php validation above doesn?t work (it always shows me this message: "1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}' at line 1 SQL=SELECT id2 FROM devedorestotais4 WHERE id={$myrowid}"), but if I change WHERE id={$myrowid} by WHERE id=2, it works.
Could give some idea for this php validation?
Thank you.
I am doing a php validation in a radio button, with this code:
$db = JFactory::getDbo();
$myrowid = '{rowid}';
$myQuery = 'SELECT id2 FROM devedorestotais4 WHERE id={$myrowid}';
$db->setQuery($myQuery);
$dt = $db->loadResult();
if($dt == '20' ){
return true;
}
else{
return false;
}
and i have this table "devedorestotais4":
id id2
1 21
2 20
3 00
4 00
5 00
6 21
When I try to edit the id=2, the php validation above doesn?t work (it always shows me this message: "1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}' at line 1 SQL=SELECT id2 FROM devedorestotais4 WHERE id={$myrowid}"), but if I change WHERE id={$myrowid} by WHERE id=2, it works.
Could give some idea for this php validation?
Thank you.