![]() |
SearchMain MenuCalendar
Site StylesLatest News |
Frequently Asked QuestionsHow do I use Majicko's built-in query system?
This is something only a moderately knowledgable webmaster is expected to understand, but we'll try to explain it. The query system that Majicko uses to handle its database queries is surprisingly simple and easy to use with few negative drawbacks. A typical query in Majicko looks like this: eval(__CONFIG__); $sql="SELECT fieldname FROM maj_table"; eval(__MySQL__); This is all you need to make the query work, unlike your more typical query systems that take many more lines of code and do exactly what these 3 lines do. You're probably asking yourself, "Ok! Now where is my data?" Simple, all of the data in the query above has now been set in the array "$fieldname[x]" for me. If you query for multiple fieldnames, you will get each row of data back in an array named after the fieldname and numbered from 0 to however many rows of data you have. How did that happen? Ok, let me walk you through what all happens in these 3 lines of code. First is eval(__CONFIG__);. This line has only one purpose: to establish our database login information from config.inc.php. That's all it does. Are you with me so far? Next line is our base query. It is using ordinary MySQL syntax and nothing particularly fancy or complex. However, it is EXTREMELY crucial that the variable carrying this query be called "$sql" and nothing else, otherwise the query system won't recognize it. Finally we have our magic command: eval(__MySQL__);. This short little line of code does all of the hard work. It is the single most important line in Majicko. This line executes the querymysql.php3 file in the globals folder which connects to your database, executes the query, processes your data into neat little arrays, and disconnects from the database. That's all there is to it. If you want to make custom pages for your copy of Majicko, you should not be somewhat familiar with the workings of Majicko's query system. |
||||||||||||||||||||||||||||||||||||||||||||||||||
© Majicko 2008. All rights reserved. | Privacy Policy | Contact Us | Copyrights | Site Map |
|||||||||||||||||||||||||||||||||||||||||||||||||||
Powered by Majicko1.3.0! ©2008 Bandwise LLC