When trying to INSERT data into a database table, I've been getting the following errors:
Notice: Undefined index: follower_user_id in C:\xampp\htdocs\blog\newentry.php on line 29
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'post', 12, NOW(), NOW())' at line 1
The related code is as follows:
$node_sql = "SELECT * FROM nodes WHERE followed_blog_id=".$row['id']." order by id DESC;";
$node_result = mysql_query($sql);
while ($node_row = mysql_fetch_assoc($node_result)){
$event_sql = "INSERT INTO events (followed_id, follower_id, type, item_id, last_active, date) VALUES (".$row['id'].", ".$node_row['follower_user_id'].", 'post', ".$item_id.", NOW(), NOW());";
mysql_query($event_sql) or die(mysql_error());
}
While the notice says the index "follower_user_id" is undefined on line 29, I checked the database table and it is the correct index spelled correctly, so I have no idea as to what is causing this problem. I've also checked the syntax for the SQL statement and I don't see any problem with it. What have I overlooked here?
Any help would be appreciated!
echo $event_sql;?$node_sqlor$sql