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. 

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