Problems Outputting PHP from MySQL -


i trying import mysql data php through wordpress php snippet plugin. whatever reason keep getting error 'mysql_fetch_array() expects parameter 1 resource, boolean'.

my code follows:

connection

[insert_php] $conn = mysql_connect("localhost", "albert", "notrealpassword") or die      (mysql_error()); 

php

mysql_select_db('mydatabase');     $query = "select * mytable"; $result = mysql_query($query); while ($subjectone = mysql_fetch_array($result)) {echo $subjectone['dataintable'];} [/insert_php] 

it because before last result answer of mysql_fetch_array array while waits bolean. know better use new mysqli functions

mysql_select_db('mydatabase');     $query = "select * mytable"; $result = mysql_query($query); while (is_array($subjectone = mysql_fetch_array($result))) {echo $subjectone['dataintable'];} 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -