Spectre Posted March 6, 2008 Share Posted March 6, 2008 Hey, I've made a lovely little php slot machine script, now i've made it to also send a news item to a specified ID in game should someone try to edit the bet amounts via the URL to anythign other than my amounts I allow. now I know it works for one id ex: mysql_query("INSERT INTO usernews (id, user, text, time) values ('','1','<a href=view.php?id=$memberinfo[id]>$memberinfo[username]</a> attempted to deliberately change the bet in slots.php to $gbet','$time')"); My problem is, I want the "user" to be more than one id, so i've made an array holding the ids I would like the message to go to, but.... can't just change the above '1' to '$notifyarray' ... I need to know a way to insert multiple rows, so one for each id in $notifyarray. Any help? (sorry, don't usually use much more than simple one row inserts and updates etc so kinda setback by this small dilemma) Link to comment https://forums.phpfreaks.com/topic/94761-inserting-trouble/ Share on other sites More sharing options...
kenchucky Posted March 6, 2008 Share Posted March 6, 2008 foreach($notifyarray as $temp)$query.="('','$temp','<a href=view.php?id=$memberinfo[id]>$memberinfo[username]</a> attempted to deliberately change the bet in slots.php to $gbet','$time'),"; mysql_query('INSERT INTO usernews (id, user, text, time) values '.rtrim($query,',')); Link to comment https://forums.phpfreaks.com/topic/94761-inserting-trouble/#findComment-485242 Share on other sites More sharing options...
Spectre Posted March 6, 2008 Author Share Posted March 6, 2008 That didn't seem to want to work, and i have no idea why, i eventually just decided to do values (stuff),(stuff2) and so on lol. Thanks anyway. Link to comment https://forums.phpfreaks.com/topic/94761-inserting-trouble/#findComment-485347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.