Ok here is my problem... I have a form on a page named index.php and the
code for the form is as follows:

<form name="auth" method="post" action="search01.php">
     <p>*I.E. - Format is 04/01/2001*</p>
     <p>Search for Ads by date:
         <input type="text" name="date">
         <input type="submit" name="login" value="Submit">
         <input type="reset" name="reset" value="Reset">

This form is used to supply the variable that we would like to seach the
database by. I.E. by date in this case. The php script that connects to the
database and performs the search is in a file named search01.php. And the
php script is as follows:

mysql_connect ("db_hostname", "db_username", "db_password");

mysql_select_db ("db_name");

if ($date == "")
{$date = '%';}

$result = mysql_query ("SELECT
FROM ads WHERE date LIKE '%$date%' LIMIT 0, 30 ");

$count = mysql_num_rows($result);

if (mysql_num_rows($result) )
while( $row = mysql_fetch_array($result) )

   print "<B>Name: </B>".$row['fname'].", ".$row[' lname']."<BR>\n";
   print "<B>Date: </B>".$row['date']."<BR>\n";
else {
print "No rows found";}

    Ok now that I have the form and the search script in place and as I test
it out I recieve an error message on 2 lines regardless of the format of the
date I use (i.e. 10/23/2001, %23%, 2001-23-10, etc.) The error messages are
as follows:

Warning: 0 is not a MySQL result index in search01.php on line 141

Warning: 0 is not a MySQL result index in search01.php on line 143
No rows found

Now that we have the background info out of the way I am wondering what
these error messages mean and how to resolve them.  I have been using a
couple of books as reference when creating this seach page but they do not
cover using a form to pass a variable to a php script for use withing a
select statement against a database.  If anyone has any ideas, suggestions
or otherwise please let me know because I would love to get this script
finished and posted somewhere.  Thanks again.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to