我试图将数组数据插入到两个mysql表中,其中一个具有另一个的fk。我使用php PDO作为插入。这就是我拥有的..。Alternatively, if your code is only ever going to run against mysql, you may enable query buffering bysetting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
by user using user id $numberOfAds = mysql_query("SELECT * FROM ads WHERE user_id='$userId'") or die(mysql_error());
return $numAds = mysql_num_rows//get ad id by user i