I need some help, I tried to develop this function. Say I have a database that has 2 colums for now.
I coded up this function to retrieve that information seperately. For example, if a user has a URL query string with user=test, then when the query run, the user should get outputs of the id's "1 and 2", but if the user=testing, then the output should be only "1"... but my logic is not working.Code:row1 column1(id) - 1 column2 - test row2 colum1(id)-2 column2 - test, testing, tester
PHP Code:$userid = $_GET['user'];
$sql = "SELECT * FROM interest";
$return = mysql_query($sql) or die ("Unable to query" . mysql_error());
while ($col = mysql_fetch_assoc($return))
{
$values = "{$col['Interested_ID']}";
$test = explode(",", $values);
for ($i=0; $i<=3; $i++)
{
//echo $test[$i];
//echo "<br>";
if ($test[$i] = $userid)
//{
// find out who is interested in that user
$qry = "SELECT UserID FROM interest WHERE Interested_ID = '$test[$i]'";
$result = mysql_query($qry) or die ("Unable to query" . mysql_error());
while ($row = mysql_fetch_assoc($result))
{
$value = "{$row['UserID']}";
echo $value;
echo "<br>";
exit;
//exit;
}
//}
}




Reply With Quote