I copied this from somewhere as I want to connect to mysql using php for the 
first time but when I execute the program below there is only blank screen (I 
already inserted a test row to my table.) 

1-In the program below what does $yourfield refer to? 

2-Isn't this supposed to display the contents of my table? It is not displaying 
anything. 

All I want is a simple program thatwill enable me to run sql queries - 
preferably in a form format. Can someone help? Thanks

<?php
//Connect To Database
$hostname='..............';
$username='..............';
$password='.................';
$dbname='...........';
$usertable='.............';
$yourfield = '.............';
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to 
database! Please try again later.');
mysql_select_db($dbname);
$query = 'SELECT * FROM $usertable';
$result = mysql_query($query);
if($result) {
    while($row = mysql_fetch_array($result)){
        $name = $row['$yourfield'];
        echo 'Name: '.$name;
    }
}
?> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]

Reply via email to