Hi, first post and it's off topic... sorry.
I'm trying to find a better way of comparing two $_POST vars and
checking if they are both in the same MYSQL table column.
Currently it's done like this:
$query ="SELECT * FROM groups";
for($i=1; $i <= $fields; $i++){
$result=mysql_query($query,$dbconn);
while($row=mysql_fetch_row($result)) {
if($_POST['item1'] != $row[$i]){
// continue search
}else{
$column1 = $i;
}
}
}
$query ="SELECT * FROM groups";
for($i=1; $i <= $fields; $i++){
$result=mysql_query($query,$dbconn);
while($row=mysql_fetch_row($result)) {
if ($_POST['item2'] != $row[$i]){
// continue search
}else{
$column2 = $i;
}
}
}
if ($column1 == $column2){
$message='Same grid';
}
There must be a better way but I don't know it.
Any help appreciate - just point me in the right direction.
Cheers
Andrew
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]