|
Posted by matthud on 02/17/07 19:54
That was a good catch, unfortunately it didn't do the trick.
Here the code is updated with $row.
$getid = mysql_query("SELECT id FROM chunks WHERE chunk = '$chunk'");
$idrow = mysql_fetch_array($getid, MYSQL_ASSOC);
$chunkid = $idrow['id'] . ",";
$eachtag = explode(",", $tags);
foreach($eachtag as $key=>$value) {
$query = "SELECT tag FROM tagtochunk WHERE tag = '$value'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 0) {
//CREATE NEW TAG ENTRY
mysql_query("INSERT INTO tagtochunk VALUES ('$value', '$chunkid')");
} else {
//UPDATE CUR TAG WITH NEW CHUNKID
$query = "SELECT tag FROM tagtochunk WHERE tag = '$value'";
$row = mysql_fetch_array($query, MYSQL_ASSOC);
$updated = $row["chunks"] . $chunkid;
mysql_query("UPDATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");
}
}
Navigation:
[Reply to this message]
|