What is wrong with this code that uses the mysql extension to fetch data from a database in PHP?

前端 未结 10 895
别跟我提以往
别跟我提以往 2021-01-17 06:18

I want to fetch data from a mysql table using php. Please, can anyone tell me what is wrong with this code? What is the correct code to fetch data from a mysql database:

10条回答
  •  情歌与酒
    2021-01-17 06:32

    Variables in php are case sensitive. Please replace your while loop with following:

    while ($rows = mysql_fetch_array($query)):
    
               $name = $rows['Name'];
               $address = $rows['Address'];
               $email = $rows['Email'];
               $subject = $rows['Subject'];
               $comment = $rows['Comment']
    
               echo "$name
    $address
    $email
    $subject
    $comment

    "; endwhile;

提交回复
热议问题