I am getting the following error: Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\wamp\www\accounting\members.php on line 10 HTML: This is the code: The connection to the database is working <?php include_once 'include/mysql.php';?> <?php echo "Welcome to the Memebers Area"; $result1 = mysql_query("SELECT * FROM trans, $connection"); while($row1 = mysql_fetch_array('$result1')) { echo $row1['product_name']; } mysql_close() ?> PHP:
Thanks @rainborick Your solution work perfectly. Also remember for the coder should remember about the quotes it's two types ("),(') if you using single into the php tag you should use the double in html so you code wouldn't be broken.
in PHP, variables are parsed inside double quotes ("), inside single quotes it doesn't because it will be treated as a normal string.