0

I am creating an array in php by assigning values retrieved from database. When I print the array it is displaying array as output and not its contents. However it does retrieve values from mysql.

$resultset=mysql_query("select isbn from tbl_book where publisherid='$publisherid'");
/***Retrieve Books*****/
while($resultISBNArray = mysql_fetch_assoc($resultset))
{
$isbn = $resultISBNArray["isbn"];
$myArr[]=$isbn;
}
echo $myArr

2 Answers 2

2

echoing any array always prints "Array". You need to pick individual values in the array (echo $myArr[0]) or use something like print_r().

Sign up to request clarification or add additional context in comments.

Comments

1

You can not print an array. You have todo something like var_dump($myArr);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.