WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL Update Picture
Benedetto Patrice
Date : May 08th 2000
Grade : 2 of 5 (graded 15 times)
Viewed : 23637
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Benedetto Patrice
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?

/*

patrice benedetto webmestre@labynet.org ( experimental )
Input this in your mySql db before running this , so you will understand how it works :)
it allows you to get 99 heads and 1--99 categorie in each node
you may improve the warning code to get more than 3 level

#
# Table structure for table 'res_cat'
#

CREATE TABLE res_cat (
ID int(32) DEFAULT '0' NOT NULL ,
ID_uname char(40) NOT NULL,
UNIQUE ID (ID)
);

#
# Dumping data for table 'res_cat'
#

INSERT INTO res_cat VALUES( '1', 'head1');
INSERT INTO res_cat VALUES( '101', 'cat11');
INSERT INTO res_cat VALUES( '102', 'cat12');
INSERT INTO res_cat VALUES( '103', 'cat13');
INSERT INTO res_cat VALUES( '10101', 'subcat111');
INSERT INTO res_cat VALUES( '10102', 'subcat112');
INSERT INTO res_cat VALUES( '10103', 'subcat113');
INSERT INTO res_cat VALUES( '1010101', 'subcat1111');
INSERT INTO res_cat VALUES( '1010102', 'subcat1112');
INSERT INTO res_cat VALUES( '1010103', 'subcat1113');
INSERT INTO res_cat VALUES( '10201', 'subcat121');
INSERT INTO res_cat VALUES( '10202', 'subcat122');
INSERT INTO res_cat VALUES( '10203', 'subcat123');
INSERT INTO res_cat VALUES( '10301', 'subcat131');
INSERT INTO res_cat VALUES( '10302', 'subcat132');
INSERT INTO res_cat VALUES( '10303', 'subcat133');
INSERT INTO res_cat VALUES( '2', 'head2');
INSERT INTO res_cat VALUES( '201', 'cat21');
INSERT INTO res_cat VALUES( '202', 'cat22');
INSERT INTO res_cat VALUES( '203', 'cat33');
etc ...
*/
$mysql_link = mysql_connect("localhost", "user", "passwd");
mysql_select_db("res_cat", $mysql_link);
echo "<html><body>" ;

function listrub ($id , $exploseID )
{
global $PHP_SELF ;
global $mysql_link ;
$maxi = ($id*100)+100 ;
$mini = $id*100 ;
$query = "SELECT * FROM res_cat where ID < $maxi and ID > $mini " ;
echo "<ol>";
if(         $mysql_result = mysql_query($query , $mysql_link) )
{
while ($row = mysql_fetch_object($mysql_result))
        {
// you have to link some action on leaves of course
echo "<li> <a href='$PHP_SELF?ID_rub=$row->ID' > $row->ID_uname </a> </li> " ;
$testID = ($exploseID - ($exploseID %100 ))/100 ; // WARNING this is ugly .. only 3 level
if ( $testID == $row->ID || $exploseID == $row->ID)
        {
                 listrub ($row->ID , $exploseID ) ;
                }
        }
}
echo "</ol>";
}
$father =999999999; // a big number
// get the grand...grand father
if ( $ID_rub >100 )
{
$father = $ID_rub ;
while ( $father >100 ) { $father= ( $father - ( $father %100) )/100 ; }
}
else{$father= $ID_rub ;}
listrub ($father , $ID_rub ,$mysql_link ) ;
echo "</body></html>";

?>



Paginating the mySQL data
Categories : PHP, Algorithms, Databases, MySQL, HTML and PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
PHP and MySQL scripting for Muyltiple CheckBoxes
Categories : HTML and PHP, MySQL, Databases, PHP
Required form fields that pull from MySQL database
Categories : PHP, HTML and PHP, Databases, MySQL
Editing the virtusertable and sendmail.cw via PHP3.0 and Mysql
Categories : MySQL, HTML and PHP, PHP, Databases
This function will populate the options in a drop down HTML select list in a form from a database query.
Categories : MySQL, General SQL, PHP, HTML and PHP, Databases
Storing / Retrieving pictures from database This can be used for banner / ads exchange. very useful for people developing big portal with ads in the site........
Categories : PHP, MySQL, Databases, HTML and PHP
This program will take data from a user via a web based form, validate it, show it to the user for re-validation, and finally insert it into the database. Plenty of sanity checking on the fields in the form.
Categories : MySQL, HTML and PHP, PHP, Complete Programs, Databases
dynamic table columns
Categories : PHP, HTML and PHP, Arrays, Databases, MySQL
Automatically printing the contents of an sql table in MySQL.
Categories : MySQL, PHP, HTML and PHP, Databases
html split bar used to split in multiple pages a database result
Categories : HTML and PHP, Databases, MySQL, PHP
How can i Preload a 'SELECT MULTIPLE'?
Categories : HTML and PHP, PHP, MySQL, Databases
bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
Complex paging with no resultset limit
Categories : PHP, MySQL, Databases, Output Control, HTML and PHP
phpFormGenerator for Dynamic Form Generation from MySQL
Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP