i want to know how can i use the code about database
http://docs.mybb.com/1.8/development/plu...ame_column
i want to read a number or a text string (a variable) from mybb database and display it into my forum (for example at the start of forumdisplay_threadlist).
Is it possible?
Where can i put the code?
Can i use this code into a template?
thanks
I think you must be more specific to get a real answer. Which database table, which column and for which row (conditions).
It will be a change in forumdisplay.php, but I suppose it can be done through one of the hooks by a plugin.
Can you supply a screenshot of forumdisplay on which you indicate what you want to add and where? Then it is possible to decide which template should be changed.
Yes..
In a plugin, custom page, core file, etc.
Only with PHP in Templates installed:
http://mybbhacks.zingaburga.com/showthre...260&page=1
Use something like:
$q = $db->simple_select('tablename', 'column');
echo $db->fetch_field($q, 'column');
You can use WHERE, LIMIT, etc. as the 3rd and 4th arguments
No. I linked a plugin you require.
thanks, it works (.....just a test).
Where can i read about the syntax of the SQL queries on MyBB?
for example,
i want to read and display all the data from a table column,
i want to display the average of the data from a table column.....
You want to study SQL, in particular MySQL since that is the most common. There are many websites out there that have this information.
(2015-07-07, 08:38 PM)dragonexpert Wrote: [ -> ]You want to study SQL, in particular MySQL since that is the most common. There are many websites out there that have this information.
can you help me, cause i read about mySQL but i can't work with SQL syntax into a MyBB template file.
for example
i have into mybb dbase a table with name "tickets" and into this table a column with name "air" with a lot of numbers into this column.
how can i calculate the average of this numbers?
how can i display this average before a post?
thanks
please answer to me cause i want to know if it's possible or not......thanks
(2015-07-08, 11:15 AM)tempo Wrote: [ -> ]how can i calculate the average of this numbers?
Either use AVG() in your query or fetch and sum the numbers in a while loop and divide them by the number of loop.
(2015-07-08, 11:15 AM)tempo Wrote: [ -> ]how can i display this average before a post?
Either use the plugin I mentioned and insert the code to a proper template or create a standalone plugin..