Jump to content

Notice: Undefined Variable: <Variable> In C:\...


teletalky

Recommended Posts

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; ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...