• Afluence
  • Owaranai Kiss
  • Ryuu no Yume
  •            
  • Kyzumi Designs
  • Ssaffira Creation
  • Apply?

Site

  • Home Page
  • About the Site
  • Past Layouts
  • FAQ//Contact
  • Linkage
  • Joined
  • Credits & Resources
  • Terms of Use

For You

  • FAMILY
  • Give it 100%?
  • Info. Please!
  • The Four Wives
  • The Cab Driver
  • Philosophy
  • Tutorials

Designs

  • Icons
  • Pre-made Layouts
  • Textures
  • Transparent Images
  • Desktop Wallpapers

Media

  • Calendar Set
  • Emoticons
  • Photoshop Brushes
  • Photoshop Patterns
  • Photoshop Splash

Total Number in the Database

  • ID: PHP - 14
  • Date Added: 2007-12-22
  • Category: PHP
  • Difficulty: Novice
  • Author: Rei
This tutorial will teach you how to display the number of rows you have in your database for a specific category. Most people usually show this for the number of tutorials, layouts, or designs they have. It can be seen as this: Showing 14 wallpapers in the database

This tutorial will require the use of Phpmyadmin, your php page, and a basic knowledge of php/mysql. This is the code you add to your page:
<?php

$user="admin"; // replace admin with username
$pass="password"; // replace password with yours
$hostname="localhost"; // hostname is 'usually' localhost
$dbase='databasename'; // replace databasename with yours
$connection = mysql_connect ("$hostname" , "$user" , "$pass"); 
mysql_select_db("databasename");
// Counting the number of rows
$count = "select * from yourtable ";
$result = mysql_query($count);
$num = mysql_num_rows($result);

echo "$num";
?>
The top portion you should already have on your page. The second part (// Counting the number of rows) shows the process of counting all the rows in the specific table. Lastly, echo "$num"; can be inserted anywhere on the page as long as it is after the php code. Basically, this is the code that displays how many rows there are in the database.

« back · clear ¦ reload · forward »
Akatsuki Designs © Rei [2006-2008]
eXTReMe Tracker
Akatsuki Designs © Rei [2006-2008]. Site, layout, and content © Rei. All rights reserved. Valid CSS and HTML
Fight Spam! | Spot a typing error? | HostTracker