I am feeding 3 variables as changing conditions (from a loop) to a function in order to grab the id column of a table where the different id's do not match these 3 conditions. I wish to create an array of all the id's that meet the condition for each loop from the results. Tried different things and can't get the result right.
I'm kind of desesperate now. 🙂 Please Help!
This the problem function:
function getrows($a,$b,$c){
$conn = mysql_connect("localhost","user","password") or die(mysql _error());
mysql_select_db($db, $conn);
$sql=select id from tablename where col1 <> $a and col2 <> $b and col3 <> $c;
$results = mysql_query($sql, $conn);
while ($rows = mysql_fetch_row($results){
$q = mysql_num_rows($results);//so far so good
/
here, I am trying to get the id's of the table that match the query criteria and make an array (a row) for each set of results. The $r variable is to number the different rows, giving each array a different name for ease of access.
I get a blank page and no result.
/
for ($i = 1; $i <= $q; $i++){
$r = 1;
${row . $r} = Array(1=>$rows[id]);
if ($i = $q) $r++;
to_more_processing (${row . $r});
}
}
}