If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Print data on mysql_table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-29-09, 04:18
satimis satimis is offline
Registered User
 
Join Date: Jun 2006
Posts: 56
Print data on mysql_table

Hi folks,

I have a php script;

# cat /home/satimis/sqlusers.php
Code:
<?php

$host="localhost"; //Database host.
$user="root"; //Database username.
$pass="apassword"; //Database password.
$dbase="maildb"; //Database.

$connect=mysql_connect($host,$user,$pass); //Connect to the database.
mysql_select_db($dbase, $connect);
$Q = "SELECT * FROM users"; // select everything
$result = mysql_query($Q);
while ($row = mysql_fetch_assoc ($result) ) { // loop through the result set
    echo $row["id"] . "<br>";
    echo $row["name"] . "<br>";
    echo $row["crypt"] . "<br>";
}

?>
On running;

# php /home/satimis/sqlusers.php
Code:
satimis@satimis.com<br>satimis<br>0e3QZ140ZrOOE<br>smsliu@satimis.com<br>smsliu<br>0eWBW8//TnfEg<br>albert@satimis.com<br>albert<br>XNP5IEvi8VZS6<br>patricia@satimis.com<br>patricia<br>0eg78AAkIGLWM<br>
postmaster@satimis.com<br>postmaster<br>0e130m.vyL/aU<br>albertcheung@satimis.com<br>Albert Cheung<br>XXvTmrqgLrBGY<br>root@vz2:/#
it printouts the data of mysql_table "users" but not in table form.

I tried putting the script on /var/www/ and renamed it as "index.html" On browser to evoke the file it did not help. No data was displayed.

Please help how to display the data on a mysql_table in table form. TIA

B.R.
satimis
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On