Created
February 5, 2016 15:32
-
-
Save yellow1912/2758139aa342f1714e25 to your computer and use it in GitHub Desktop.
sample query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first query, please make sure you modify this query to fit your purpose | |
$ids_array = array(); | |
$result = mysql_query("SELECT id FROM table_name"); | |
while($row = mysql_fetch_array($result)) | |
{ | |
$ids_array[] = $row['id']; | |
} | |
// second query, please make sure you modify this query to fit your purpose | |
$result = mysql_query("SELECT product_id, sku, qty FROM table_name"); | |
$result_array = array(); | |
while($row = mysql_fetch_array($result)) | |
{ | |
if (in_array($row['product_id'], $ids_array)) { | |
$row['qty'] = 0; | |
} | |
$result_array[] = $row; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment