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 : It's easy to select multiple rows from a mySql Table.
Categories : PHP, MySQL, Databases Click here to Update Your Picture
Mian Shafiq ur Rehman
Date : Jan 31st 2005
Grade : 3 of 5 (graded 12 times)
Viewed : 10366
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Mian Shafiq ur Rehman
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Title : selecting multiple rows.
Version: 1.0.0
Author: Mian Shafiq-ur-Rehman
Email : gurru@phpgurru.com
Mess : rehmanms@hotmail.com
Website: www.phpgurru.com

If you want to select multiple rows from a mySql Table, you have no need to worry about. This function will do every thing. All you have to do is to pass an SQL query to this function and it will return a 2D array.


<?php
function selectMultiRows($query)
{   
    if((@
$result = mysql_query ($query))==FALSE)
       {
        echo
"<strong>Error in your query:</strong> <br>$query";
    }   
    else
     {   
       
$count = 0;
       
$data = array();
        while (
$row = mysql_fetch_array($result))
        {
           
$data[$count] = $row;
           
$count++;
        }
            return
$data;
    }
}
?>



Usage Example
<?php
$query
= "select * from Users";
$returnedData = selectMultiRows($query);
$totalRecords count($returnedData);

for(
$i=0;$i<$totalRecords;$i++)
{
    echo
$returnedData[$i]["username"] . "<br>";
}
?>



bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
MyOrgBook - Online Organizer written in PHP & MySql. Includes online contacts, todo, calendar, update, delete, insert, multi-user interface.
Categories : PHP, MySQL, Calendar, PDAs and Organizers, Databases
Simple usersOnline class - keep track of how many users are online on your site
Categories : PHP, PHP Classes, Databases, MySQL
Function to check connection to MySQL and redirect to an error page if an error occurs
Categories : MySQL, PHP, Debugging, Databases
MySQL Web Interface
Categories : MySQL, Databases, PHP
A PHP useradmin for MySQL. Uploading is easy. The only thing you need is PHP and MySQL installed!
Categories : MySQL, Databases, PHP, HTML and PHP
PostGreSQL and MySQL 2 in 1 db Manager
Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL
AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page.
Categories : PHP, AJAX, Databases, MySQL, Java Script
Loading Images to/from MySQL
Categories : Databases, MySQL, PHP, Graphics
Solution to those 'tell-a-friend' type email issues
Categories : PHP, Email, Databases, MySQL
PHP Object Example of the Perl DBI with MySQL
Categories : PHP, PHP Classes, MySQL, Databases, Perl
[PHP5] aDB PDO LIKE Database Abstraction. Switch easily from one db server to another, strong errors management, manage transactions, queries preparation and more.
Categories : PHP, PHP Classes, Databases, MS SQL Server, MySQL
Shopping Basket On-Line Ordering System.
Categories : Complete Programs, MySQL, PHP, Ecommerce, Databases
Simple function to return the number of days in a time span between 2 given dates.
Categories : PHP, Date Time, MySQL, Databases
 Olaf Lederer wrote : 1267
why not: 

$query = "select * from Users";
$result = mysql_query ($query);
while ( $row = mysql_fetch_array($result)) {
    echo $row[`username`];
}
what is the clou of this function ?
 
 Olaf Lederer wrote :1268
it`s late
clou = advantage

;-) (clou is dutch)