Re: create and read array
| From: | John Holmes | Date: | Sat, 11 Sep 2004 03:55:33 +0000 |
| Subject: | Re: create and read array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196386@lists.php.net to get a copy of this message | ||
John Taylor-Johnston wrote:
Can someone help me, show me how to do this please? 1. How do I write $mydata->AUS and $mydata->id into an array? $authors = array(); while ($mydata = mysql_fetch_object($news)) { # echo "$mydata->AUS, $mydata->id\n"; ??? write to array } mysql_close($myconnection);What do you mean "write to array"?? $array = array($mydata->AUS,$mydata->id); That?
2. Then I need to create $SQL foreach ($authors as something) { $sql += "INSERT INTO newtable VALUES ($AUS, $id);\r\n"; }+= is addition. I doubt that's what you want. $sql .= "INSERT INTO newtable VALUES ({$mydata->AUS},{$mydata->id});\r\n"; Not sure why you're joining all these queries together, you can only run one at a time with MySQL... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com