Jump to content

Recommended Posts

Posted

I am new to PHP, and while following the tutorial from the videos (MySQL, SQL & PHP) I kept on getting the following error message:

 

Notice: undefined variable: my_rows in c:\...

 

However, the variable 'my_rows' has been declared, as shown on the code below. I have made change on the php.ini (error_reporting) without success. Can anyone help???

 

$query = "SELECT * FROM people";

$result = mysql_query($query);

$my_rows;

while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

$my_rows = $my_rows . "Name : {$my_rows['name']} <br>" . "id : {$row['id']} <br><br>";

}

mysql_close($my_connection);

?>

</head>

<body>

<?php echo $my_rows; ?>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...