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_databaseIt looks like the code is not generated. What am I doing wrong?"> PHP code is not generated - Forums

Forums

PHP code is not generated

goliath 17 Jun, 2014
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?
GreyHead 17 Jun, 2014
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
goliath 18 Jun, 2014
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!
Max_admin 28 Jun, 2014
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 ?
goliath 21 May, 2015
Hi Max

I'm no great php expert at all.
Any idea on how to output the result here?

Regards

Geert
Max_admin 22 May, 2015
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 ?
This topic is locked and no more replies can be posted.