Hi Aaron,

I noticed several things, first you are fetching your database row into
$rows but you are referencing the data in $row, and second you do not
have a $ in front of your $row variable name, in order to get the
contents of a variable you must use $variable.

I've included modified code to demonstrate.

Jason

while ($rows=mysql_fetch_array($mysql_result)) {      
$ID=row['ID'];                                                          
# this is line 30
      
$first_name=row['first_name'];                                     
       $surname=row['surname'];
       $email=row['email'];
       $comments=row['comments'];

needs to be

while ($row = mysql_fetch_array($mysql_result)) {
      
$ID=$row['ID'];                                                           # this is 
line 30
      
$first_name=$row['first_name'];                                     
       $surname=$row['surname'];
       $email=$row['email'];
       $comments=$row['comments'];
On Tue, 2003-02-04 at 21:44, Aaron Downes wrote:
> Dear Sir/Madam,
> 
> trying to displaying records by php get error :
> Parse error: parse error in 
>/hsphere/local/home/ozhomene/ardownes.com/ViewContacts.php on line 30
>  
> see below for code for ViewContacts.php :
>  
> <html>
> <body>
> 
> <?
> 
> $connection=mysql_connect("localhost","","");    #am entering userID &password 
>instead of ,"","")
> 
> IF (!$connection) {
>     echo "Could not connect to mySQL server";
>     exit;
> }
> 
> $db=mysql_select_db("test_holding",$connection);
> 
> if (!$db) {
>    echo "Could not change the  database";
>    exit;
> }
> 
> #sql="SELECT * FROM contacts";            # name of table "contacts"  with below 
>fields
> 
> #mysql_result=mysql_query($sql,$connection);
> $num_rows=mysql_num_rows($mysql_result);
> 
> if ( $num_rows == 0 ) {
>    echo "Sorry, there is no information.";
> } else {
>    #we have results
>    while ($rows=mysql_fetch_array($mysql_result)) {
>        $ID=row['ID'];                                                           # 
>this is line 30
>        $first_name=row['first_name'];                                     
>        $surname=row['surname'];
>        $email=row['email'];
>        $comments=row['comments'];
>        # display results
>        echo "$fist_name : $surname $email $comments<br>";
>    }
> } # end else
> 
> mysql_close($connection);
> 
> ?>
> 
> </body>
> </html>      
>   
> Any help will be appreciated.
>  
> Best regards,
> Aaron Downes
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to