herghost Posted November 3, 2009 Share Posted November 3, 2009 Hi all, I have two questions, both of which ill run once a month from a cron script. 1, How can I empty a table called users_stocks_details from PHP? 2, In the users_stocks_detils table I have the following coloums: user_id stock_id quant Once this has been emptied I want to add every users id that has 10 or more credits (see below) with the stock_id of 0 and the quant of 100. I have this so far but not sure where to go with it!: $query="SELECT credits FROM users_details"; $result = mysql_query($query, $conn) or die(mysql_error($conn)); $rows = mysql_fetch_array($result); extract($rows); if ($rows['credits'] => 10) { Many Thanks Link to comment https://forums.phpfreaks.com/topic/180086-solved-phpmysql-query-questions/ Share on other sites More sharing options...
Mchl Posted November 3, 2009 Share Posted November 3, 2009 1. TRUCANTE TABLE users_stocks_details 2. INSERT INTO users_stocks_details SELECT user_id,0,100 FROM users_details WHERE credits > 10 Link to comment https://forums.phpfreaks.com/topic/180086-solved-phpmysql-query-questions/#findComment-950029 Share on other sites More sharing options...
herghost Posted November 3, 2009 Author Share Posted November 3, 2009 fantastic! Thanks Link to comment https://forums.phpfreaks.com/topic/180086-solved-phpmysql-query-questions/#findComment-950039 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.