Everything the errors are pointing to is the result reference returned in
$result. If your query fails and you just try to read the result you will
get that error. Try something like this:

$result = mysql_query( "SELECT * from nctd_reviews WHERE model_year='$year'
AND manufacturer_name='$make' ORDER BY 'model_year','manufacturer_name'" );

if ((!$result) || (mysql_num_rows($result) < 1)) {
    if (mysql_error() != "") {
        print ("There were no results");
    }
    else {
        die ("SQL Error: " . mysql_error());
    }
}
else {
    // continue, this is a valid returned result set
}

Let me know if this helps.

-Toby

----- Original Message -----
From: "Tom Mathews" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, February 01, 2001 11:15 AM
Subject: Re: [PHP-WIN] Newbie - Help!!!!!


> If there was an error with the DB connection, then the 'or die' clause
should
> pick it up?
> If nothing has changed between the IIS nad Apache implementation then I
don't
> know what is happenning
> If however you have changed the table structure at the same time... or
maybe
> don't have any records on your DB?
>
> Tom
>
> Toby Miller wrote:
>
> > There seems to be a problem with your database connection. Can we see
the
> > header include?
> >
> > -Toby
> >
> > ----- Original Message -----
> > From: "Robert Trembath" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, February 01, 2001 10:20 AM
> > Subject: [PHP-WIN] Newbie - Help!!!!!
> >
> > I don't understand why I getting an error on this. it ran on my IIS/PHP
> > machine but on my Apache/PHP I get errors. Here the code and the
results,
> > Please help:
> >
> > <?php
> > session_start();
> > include("./inc/php_header.php")
> > ?>
> > <font face=Arial size=2>
> > <?php
> > include("./mysql_connect_inc.php");
> > print "<h3>New Vehicle Search</h3><p>";
> > mysql_select_db( $db )
> >         or die ( "Couldn't open $db: ".mysql_error() );
> > $result = mysql_query( "SELECT * from nctd_reviews WHERE
> > model_year='$year'AND manufacturer_name='$make' ORDER BY 'model_year',
> > 'manufacturer_name'" );
> > $rows = mysql_num_rows( $result );
> > print "There are currently $rows vehicles that match your criteria.<p>";
> > print "<table width=475 border=0 cellpadding=0 cellspacing=1>\n";
> > print "<tr bgcolor=#D0D4E8><td width=50><font
> > size=2><b>Year</b></font></td>";
> > print "<td width=325><font size=2><b>Make & Model</b></font></td><td
> > width=100><font size=2><b>MSRP</b></font></td></tr>";
> > while ($r = mysql_fetch_array($result))
> >         {
> >         extract($r);
> >         print "<tr>\n";
> >         print "<td><font size=2>$model_year</font></td><td><font
size=2><a
> > href='vehicledetail.php?id=$ID'>$manufacturer_name
> > $model_name</a></font></td><td><font size=2>$
$base_price</td></font>\n";
> >         print "</tr>\n";
> >         $selectedyear = "$year";
> >         $selectedmake = "$make";
> >         }
> > print "</font></table>\n";
> > mysql_close( $link );
> > include("./inc/php_footer.php")
> > ?>
> >
> > Now the errors:
> >
> > Warning: Supplied argument is not a valid MySQL result resource in
> > c:\apache\htdocs\ishophouston\newvehicles.php on line 12
> > There are currently vehicles that match your criteria.
> >       Year Make & Model MSRP
> >
> >   Warning: Supplied argument is not a valid MySQL result resource in
> > c:\apache\htdocs\ishophouston\newvehicles.php on line 17
> >
> > --
> > PHP Windows 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]
>
>


----------------------------------------------------------------------------
----


> --
> PHP Windows 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]


-- 
PHP Windows 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