PHP-Nuke
  Strona głównaDownloadForumFAQ Zaloguj się  
 Menu
 Home :
 Strona główna
 Demo PHPNuke
 Archiwum
 Użytkownicy :
 Ekipa phpnuke.org.pl
 Lista Użytkowników
 Prywatne wiadomości
 Online
 Menu :
 Regulamin
 Kontakt
 Linki
 Download
 Dokumentacja :
 FAQ
 Idiots Guide
 Polecamy
» domy drewniane
 Tools
 Module Creator
 Block Creator
 HTML to PHP
 HTML to Javascript
 Online HTML Editor
 Meta Tag Creator
 Popup Creator
 Scrollbar Creator
 Hex Colors
 Previewer
 HTML Encoder
 URL Encoder
 Rot-13 Encoder
 DB Generator
 MD5 Calculator
 Top Themes
1.Tesko1123
2.BLock759
3.ICGstation595
4.Dw-Advance487
5.Fiblack3d467
6.ZoneBlue434
7.Cobalt361
8.Aeolus349
9.PH2BLUE332
10.XPMidnight315
The Complete Idiots Guide to Nuke  v.3.2

Idiots Guide Home Page
About PHP-Nuke
Installation
The Administration panel
Add-On types
Forums
Developers Guide to Nuke
Troubleshooting
Useful Links
Development Home
Globals and Common Functions
Modules Development
Theme Development
Blocks Development
Admin Section Development
Database Integration

Database Integration

Database integration is really quite simple. There are three globals that apply to Databases in Nuke. These are: $db, $prefix and $user_prefix.

When initiating a database query, you use the $db global, followed by the query type, then the query.

The query types are as follows:
sql_queryNormal SQL query for Selects, Inserts, Updates, Detetes and any table / database structure changes
sql_numrowscounts the number of rows returned by the query
sql_fetchrowCreates an array of values that the query returned


So, a typical database query might look as follows:

$sql = "SELECT * FROM ".$prefix."_random_table WHERE id=1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);


Now, the reason why we put ".$prefix." in there instead of nuke is because not everybody uses the nuke prefix on their databases, so by putting ".$prefix." the prefix that the site has on the config.php file will be called.

Sometimes, $prefix will be replaced with $user_prefix if the query is being targeted at the users table of the database. This is because some sites share a database but use different prefixes to keep the sites information seperate, but in these cases, it is also common for these sites to share a user table to save people having to register twice on the sites.

Last Updated: July 6th 2003
 

Copyright © 2004-2009 by phpnuke.org.pl :: PHP-Nuke Copyright © 2004 by Francisco Burzi.
Zdjęcia ślubne
Tworzenie strony: 0.14 sekund
Zapytań: 10