I have put some php code in the header of one of my lists in CC:
<?php
$sql = "SELECT COUNT(name_of_my_table) FROM name_of_my_database";
echo $sql;
?>
I expected that this would display some values on the front end of my list but the only thing I see is SELECT COUNT(name_of_my_table) FROM name_of_my_database
It looks like the code is not generated. What am I doing wrong?
Hi geertmaartens,
It looks as though the code is working perfectly. It is echoing the string that you have defined.
If it was set up to run a MySQL query I don't think it would do anything more than return a number (the count) and I'm not certain about that.
What are you actually trying to do?
Bob
Hi Bob
Well that's what I thought it would do also (to return a number). But it returns SELECT COUNT(name_of_my_table) FROM name_of_my_database.
But in the meantime I tried another script and that's working fine ! So, problem solved! Thanks Bob!
The code outputs the SQL query without executing it, so what you had is normal, you had to execute the query and output the result to get the count.
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Max
I'm no great php expert at all.
Any idea on how to output the result here?
Regards
Geert
Hi Geert,
Please check this page:
https://docs.joomla.org/Selecting_data_using_JDatabase
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?