Hey Guys...
Brain is kind of dead on a late thursday afternoon in Cape Town,
Can anybody please assist...
what i am trying to do is:
1) in a table i have a column that is an array, its all in plain text
2) i have a table that has those names with id's
3) i want to get all values of the text to be id's, then repopulate the array and insert back into the table,
so instead of have and array like (word1,word2,word3) i want to take out $word1 replace it with an ID eg.3 and so on for the rest of the array for each record.
so then i would have (1,568,771) obviously.
The //***
part i have error handled and it shows that the array is populating with correct info according to the ID, the 2nd part my brain seems to be bummed!
dbconn() is my mysql_connect function
Please help fellow Developers!
<?php
$sql = "SELECT CandidateID, UserName, Categories FROM Candidates WHERE Categories != '' ORDER BY CandidateID";
$rs = dbconn($sql);
$row = mysql_fetch_array($rs);
$rows = mysql_num_rows($rs);
for ($f=0;$f<$rows;$f++){
$array_cat = array(mysql_result($rs,$f,"Categories"));
foreach ($array_cat as $ar){
//*** echo mysql_result($rs,$f,"CandidateID") . $ar; ***
$sql2 = "SELECT * FROM Can_Categories_List WHERE CategoryName = '".$ar."' ";
$rs2 = dbconn($sql2);
$row2 = mysql_fetch_array($rs2);
$rows2 = mysql_num_rows($rs2);
for ($j=0;$j<$rows2;$j++){
echo mysql_result($rs2,$j,"CategoryID") . "-" .mysql_result($rs,$f,"CandidateID") . "<br />";
}
}}
?>