problems with array again
| From: | afan | Date: | Fri, 01 Dec 2000 19:26:13 +0000 |
| Subject: | problems with array again | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-4226@lists.php.net to get a copy of this message | ||
Hi guys,
again problems with arrays:
$content = array("afan", "pasalix", "astoria", "new york");
$result = mysql_query("UPDATE test SET content='$content' WHERE id=1 ",$db);
$result = mysql_query("SELECT * FROM test WHERE id=1", $db);
$myrow = mysql_fetch_array($result);
$NewContent = $myrow["content"];
$counter = count($NewContent);
echo"\$counter: $counter<br>";
for($x=0; $x<$counter; $x++)
{
echo"Content[$x]: $contentdb[$x]<br>";
}
On screen is:
$counter: 1
$contentdb[0]: A
$contentdb[1]: r
$contentdb[2]: r
$contentdb[3]: a
If, instead of: $NewContent = $myrow["content"];
I put
$NewContent[] = $myrow["content"];
results look like:
$counter: 1
$contentdb[0]: Array
$contentdb[1]:
$contentdb[2]:
$contentdb[3]:
Why I can't put an array in database?
Thanks!