senator
Guest
Простой поиск по БД
вот такой вопрос:
$query = "SELECT name,lastname,email FROM info WHERE $category = '$key'";
$result = mysql_result($query);
if (mysql_fetch_row($result) == 0)
print "Sorry, but no matches were found. Please try your search again:";
list($name, $lastname, $email) = mysql_fetch_row($result);
print "<h3>Information:</h3>";
print "<b>Name:</b> $name <br>";
print "<b>LastName</b> $lastname <br>";
print "<b>Email:</b> <a href-\"mailto:$email\">$email</a> <br>";
три переменные пл которым орг. поиск:
$name
$lastname
$email
получаем их из формы
<form action="search.php" method="POST">
Search by:
<select name="category">
<br>
<option value-"name">Name<br>
<option value="lastname">Lastname<br>
</select><br><br>
Keyword:
<input type="text" name="key" size="20" maxlength="20"><br><br>
<input type="submit" value="Search">
</form>
вроде всё в норме, вот почему то не работает?
вот какая ошибка вылазит:
Warning: Wrong parameter count for mysql_result() in e:\home\localhost\www\search.php on line 7
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in e:\home\localhost\www\search.php on line 9
Sorry, but no matches were found. Please try your search again:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in e:\home\localhost\www\search.php on line 12
вот такой вопрос:
$query = "SELECT name,lastname,email FROM info WHERE $category = '$key'";
$result = mysql_result($query);
if (mysql_fetch_row($result) == 0)
print "Sorry, but no matches were found. Please try your search again:";
list($name, $lastname, $email) = mysql_fetch_row($result);
print "<h3>Information:</h3>";
print "<b>Name:</b> $name <br>";
print "<b>LastName</b> $lastname <br>";
print "<b>Email:</b> <a href-\"mailto:$email\">$email</a> <br>";
три переменные пл которым орг. поиск:
$name
$lastname
получаем их из формы
<form action="search.php" method="POST">
Search by:
<select name="category">
<br>
<option value-"name">Name<br>
<option value="lastname">Lastname<br>
</select><br><br>
Keyword:
<input type="text" name="key" size="20" maxlength="20"><br><br>
<input type="submit" value="Search">
</form>
вроде всё в норме, вот почему то не работает?
вот какая ошибка вылазит:
Warning: Wrong parameter count for mysql_result() in e:\home\localhost\www\search.php on line 7
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in e:\home\localhost\www\search.php on line 9
Sorry, but no matches were found. Please try your search again:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in e:\home\localhost\www\search.php on line 12