Home >Backend Development >PHP Tutorial >How to Fix the \'Array to String Conversion\' Error in PHP When Displaying Database Values?
Array to String Conversion in PHP
When attempting to select a database value and display it using PHP's SELECT statement, a common error you may encounter is:
Notice: Array to string conversion in (pathname) on line 36.
This error indicates that you are trying to assign an array to a string variable. In this case, the array is returned by the mysql_fetch_assoc() function. To resolve this issue, modify your code as follows:
'.... Money:'.$money['money']
By adding the index of the array (in this case, 'money'), you are specifying the specific value you want to retrieve from the array. This ensures that you are assigning a string value to the variable.
The above is the detailed content of How to Fix the 'Array to String Conversion' Error in PHP When Displaying Database Values?. For more information, please follow other related articles on the PHP Chinese website!