Welcome To Whisper Willows PHP-Fusion Mod Support Center In Fort Worth, Texas


PHP-Fusion is a light-weight open-source content management system (CMS) written in PHP 5 (compatible with PHP 4). It utilizes a MySQL database to store your site content and includes a simple, comprehensive administration system. PHP-Fusion includes the most common features you would expect to see in many other CMS packages including news, articles, forums, polls, shoutbox, comments, ratings and much more. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License (AGPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

WhisperWillows PHP-Fusion Mod Support center primarily exists to test, promote and support Themes, Mods and Infusions that I have developed for PHP-Fusion v7 CMS system. I will also install and test Themes, Mods and Infusions that other coders and developers have made available. In order to download my Themes, Mods and Infusions for usage or testing, you must be a registered member of my website. It's quick, free and easy!

I will provide support for my Mods Infusions and Themes and will attempt to address any and all issues that you may encounter. Please use the appropriate Support Forum for posting questions and assistance requests. The site will change periodically as I test new themes, mods and infusions.



 Thinking about trying out PHP-Fusion CMS? Get The Latest Releases Below 


Navigation
 Main
 Community  Members  Entertainment  Support  Legal
Event Calendar

 Summer Season 

 « June 2019 » 
Sun Mon Tue Wed Thu Fri Sat
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

Birthdays
06-01 zodan

06-22 zottelxxl

06-24 martinde

06-28 bogdan

06-30 Costa1337

No Events
Subscriptions
Newsletter

Site Members Only

Classified Ads


0 Classified Ads


Version 5.02
Site User Pages

New Site User Pages

afoster
21Matze
gjsttt
outlaw
FreedomIOPList


Most Visited Pages

Gargon[916]
Webmaster[879]
outlaw[590]
FreedomIOPList[527]
gjsttt[489]
Latest Articles
PHP-Fusion Multiple ...
PHP-Fusion ver7.02.07
MySQL/DB Functions
Articles Hierarchy
Articles Home » (D) PHP-Fusion CMS Tutorials » MySQL/DB Functions
MySQL/DB Functions
Before beginning, I will hereby assume that you (the reader) understand/know/learn MySQL to a certain level. Even if you know nothing about MySQL, this may help you get started.

And now, on to the nitty-gritty:

MySQL database function code snippets

[1]
     function dbquery($query) {
}

[2]
     function dbarray($query) {
}

[3]
     function dbarraynum($query) {
}

[4]
     function dbrows($query) {
}

[5]
     function dbresult($query, $row) {
}

[6]
     function dbcount($field, $table, $conditions = "") {
}

These are the 'function' declarations in maincore.php. No, you don't have to open maincore.php, these are just samples to look at. They should provide you with some idea of how the functions work. If you don't understand the functions at first glance, don't worry. We'll explain each one in detail.
FUNCTIONS with EXAMPLES

1. dbquery($query)
This function executes a query on a MySQL database and returns a value. If the query 'fails' it will produce an error message and return 'false'.
dbquery() - is followed up by other functions listed above. There is only one parameter for this function: the 'SQL query'. Like mysql_query(), dbquery() is also used for UPDATE, DELETE, INSERT, and CREATE, but you won't be using CREATE.
2. dbarray($query)
A clone of the mysql_fetch_assoc() function that returns a row from a record-set as an associative array. If the query 'fails' it will produce an error message and return 'false'.

dbarray() requires the return value from dbquery(), because the return value specifies which result handle to use.
EXAMPLE

$query = "SELECT * FROM ".DB_DATA." WHERE data_id = '{$_GET['p']}'";
$result = dbquery($query);
if($db = dbarray($result)){
$d['id'] = $db['data_id'];
$d['name'] = $db['data_name'];
$d['desc'] = $db['data_desc'];
$d['access'] = $db['data_access'];
}
else{
$d['error'] = "No data found";
}

3. dbarraynum($query)
A clone of the mysql_fetch_row() function that returns a row from a record-set as a numeric array. If the query 'fails' it will produce an error message and return 'false'.

This function is very similar to dbarray. You will understand after reading the example.

dbarraynum() requires the return value from dbquery(), because the return value specifies which result handle to use.
EXAMPLE

$query = "SELECT * FROM ".DB_DATA." WHERE data_id = '{$_GET['p']}'";
$result = dbquery($query);
$d = dbarraynum($result)
if(empty($d['id'])){
$error = "No data found";
}

4. dbrows($query)
A clone of the mysql_num_rows() function that returns the number of rows in a record-set. If the query 'fails' it will produce an error message and return 'false'.

dbrows() requires the return value from dbquery(), because the return value specifies which result handle to use.
EXAMPLE

$query = "SELECT * FROM ".DB_DATA.";
$result = dbquery($query);
$d_rows = dbrows($result);
if (!$d_rows){
$d['error'] = "Cannot count rows in data table";
}

5. dbresult($query, $row)
A clone of the mysql_result() function that returns the value of a field in a record-set. If the query 'fails' it will produce an error message and return 'false'.

dbresult() requires the return value from dbquery(). Because the return value specifies which result handle to use.
EXAMPLE

$query = "SELECT * FROM ".DB_DATA." WHERE data_id = '{$_GET['p']}'";
$result = dbquery($query);
$d['name'] = dbresult($result, 1);
if (!$d['name']){
$d['error'] = "No Name found";
}

And Now For DB Count

6. dbcount($field, $table, $conditions = "")
This function executes a COUNT query on a MySQL database and returns a value. COUNT query means it counts the total value of records found. If the query 'fails' it will produce an error message and return 'false'.
dbcount() does not require a result from dbquery()
dbcount() is usually used for paginations
dbcount() has 3 parameters, two of which are required:

  • Parameter 1: ==> $field (required)
       { signifies which field in the table to be counted }


  • Parameter 2: ==> $table (required)
       { signifies which table is to be counted }


  • Parameter 3: ==> $conditions = "" (optional)
       { signifies the conditions that the field needs to meet }


Condition example in MySQL:
" WHERE field_name = 'some_value' AND field_name2 = 'other_value' "
EXAMPLE

this example returns the values of increments of 10
starting from zero. e.g, 0, 10, 20, 30 .. etc. etc.
$count = dbcount("(data_id)", DB_DATA, "data_access='".$d_ac.");
$count = ($count / 10) - 1;
$d_count = ceil($count) * 10;
if (!$d_count){
$d['error'] = "Cannot count data";
}

And that's all for now folks...
Used with permission by:
elyn @ phpfusion-mods.net
Posted by Webmaster on March 13, 2009 16:49:21
Ratings
Rating is available to Members only.

Please login or register to vote.

Awesome! Awesome! 100% [1 Vote]
Very Good Very Good 0% [No Votes]
Good Good 0% [No Votes]
Average Average 0% [No Votes]
Poor Poor 0% [No Votes]
Sign In
Enter Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Users Online Now
Guests Online: 2
Total Members: 688

Unactivated Members: 0
Newest Member: kokol

Last Seen Admin
Webmaster00:14:38

Last Seen Users
Harlekin 1 week
Der WU 1 week
afoster 2 weeks
kokol 3 weeks
aznetcowboy 6 weeks
evanernanda 7 weeks
douwe_yntema25 weeks
wizard0121031 weeks
21Matze34 weeks
Gargon35 weeks
Beyond6339 weeks
kenloen39 weeks
helmuth41 weeks
Ingolstadt46 weeks
outlaw46 weeks
Shoutbox
You must login to post a message.

 Gargon
Since 02/19/2009
On August 02, 2018 00:34
OK... new shoutbox stuff huh? Kool !!

 Webmaster
Since 08/14/2008
On August 01, 2018 11:44
Hey hey I think I have it Fred !!!

 Webmaster
Since 08/14/2008
On August 01, 2018 11:29
Sure will Fred !!

 afoster
Since 01/23/2009
On August 01, 2018 11:15
OK, I see what you are talking about and yes...the online/offline icons are not needed. Can you send me the "finished" product when you are done?

 afoster
Since 01/23/2009
On August 01, 2018 10:51
Let me know what oddities you are talking about. If there are any code issues, I am sure you fill find and fix them.