TO_DAYS('$date')"; $and++; } if ($uname != "") { $uname = addslashes($uname); if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "name LIKE '$uname'"; $and++; } if ($email != "") { $email = addslashes($email); if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "email LIKE '$email'"; $and++; } if ($institute != "") { $institute = addslashes($institute); if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "institute LIKE '$institute'"; $and++; } if ($hepexp != "") { if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "hepexp LIKE '%$hepexp%'"; $and++; } if ($experiment != "" && $hepexp == "") { $experiment = addslashes($experiment); if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "experiment LIKE '$experiment'"; $and++; } if ($category != "") { if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "category LIKE '%$category%'"; $and++; } if ($desc != "") { $desc = addslashes($desc); if (!$and) $sql .= " WHERE "; if ($and) $sql .= " AND "; $sql .= "description LIKE '%$desc%'"; $and++; } // raw SQL statement overrides other settings if ($mysql != "") $sql = $mysql; echo "The following query has been issued:
\n"; echo "$sql
\n"; // access database if ($db = mysql_connect("localhost", "nobody", "")) { if (mysql_select_db("root", $db)) { if ($result = mysql_query($sql, $db)) { $i = mysql_num_rows($result); if ($i == 0) { echo "No records found\n"; mysql_close($db); return; } echo "$i records found
\n"; echo "
$fname | "; } echo "|
---|---|
- | "; else echo "$row[$i] | "; } echo "