Skip to content

Instantly share code, notes, and snippets.

@yellow1912
Created February 5, 2016 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yellow1912/2758139aa342f1714e25 to your computer and use it in GitHub Desktop.
Save yellow1912/2758139aa342f1714e25 to your computer and use it in GitHub Desktop.
sample query
// 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