I’m trying to render values to a table with a delete link. Now my problem is that I need to pass the mysql row id to a function that will delete the value from the table and refresh. Everything is ok except for the delex sub-query,
I have failed to get the id inside the function, it just passed null values to the function
how do I get the row id inside the function
deletex($RowID)
my query is here. any ideas?,
$query="SELECT username as '{$mylanguage['username']}',
vchCode as '{$mylanguage['voucher_code']}',
vchStatus as '{$mylanguage['status']}',
vchDateCreated as '{$mylanguage['date']}',
vchDateUsed as '{$mylanguage['date_used']}',
CONCAT('<a href=\"#\" onclick=\"return deletx(\'',SELECT vchID,'\')\">".$mylanguage['delete']."</a>') as ' '
FROM $tablename
LEFT JOIN #__users ON $uniqueKey = id
".$_SESSION['query_condition']."
ORDER BY vchID DESC
LIMIT ". ($pagination['start'] - 1) .",{$pagination['size']}";
I don’t think returning HTML from a SQL query is a particulary good idea. You should rather return the ID, then insert it into the HTML using PHP.
Add
vchIDto the select. Lets assume you got your SQL result as an assosiative array namedresult, the code would look like this.