//GET INSERTED CHUNK ID
$getid = mysql_query("SE LECT id FROM chunks WHERE chunk = '$chunk'");
$idrow = mysql_fetch_arr ay($getid, MYSQL_ASSOC);
$chunkid = $idrow["id"].",";
$eachtag = explode(",", $tags);
foreach($eachta g as $key=>$value) {
For some reason, this code:
$updated = $row["chunks"] . $chunkid;
mysql_query("UP DATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");
only updates the field with $chunkid, leaving out row["chunks"]. I'm
guessing it may have something to do with scope within control
structures.... I'm at a loss.
$query = "SELECT chunks FROM tagtochunk WHERE tag = '$value'";
$result = mysql_query($qu ery);
if (mysql_num_rows ($result) == 0) {
//CREATE NEW TAG ENTRY
mysql_query("IN SERT INTO tagtochunk (tag, chunks) VALUES ('$value',
'$chunkid')");
} else {
//UPDATE CUR TAG WITH NEW CHUNKID
$updated = $row["chunks"].$chunkid;
mysql_query("UP DATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");
}
}
mysql_close($co n);
?>
$getid = mysql_query("SE LECT id FROM chunks WHERE chunk = '$chunk'");
$idrow = mysql_fetch_arr ay($getid, MYSQL_ASSOC);
$chunkid = $idrow["id"].",";
$eachtag = explode(",", $tags);
foreach($eachta g as $key=>$value) {
For some reason, this code:
$updated = $row["chunks"] . $chunkid;
mysql_query("UP DATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");
only updates the field with $chunkid, leaving out row["chunks"]. I'm
guessing it may have something to do with scope within control
structures.... I'm at a loss.
$query = "SELECT chunks FROM tagtochunk WHERE tag = '$value'";
$result = mysql_query($qu ery);
if (mysql_num_rows ($result) == 0) {
//CREATE NEW TAG ENTRY
mysql_query("IN SERT INTO tagtochunk (tag, chunks) VALUES ('$value',
'$chunkid')");
} else {
//UPDATE CUR TAG WITH NEW CHUNKID
$updated = $row["chunks"].$chunkid;
mysql_query("UP DATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");
}
}
mysql_close($co n);
?>
Comment