Try getting the results from the query like the following.


// generate and execute query
$query = "select * from changelog where changedBy = '$changedBy' or
vendorNumber = '$vendorNumber'
or oldName like '$oldName' or newName like '$newName' or
newVendorNumber =
$result = mysql_query($query) or die ("Error in query: $query. " .

$numrows = mysql_num_rows ($result)

if ($numrows) {
while ($row = mysql_fetch_array($result)) {
   print "<b><u>Old vendor number</u>: </b>";
   print $row["vendorNumber"];
   print "<br>";
  }  //end while

} else {print "Sorry, no records were found!";}

// close database connection

On Thu, 6 Feb 2003 11:41:30 -0500, Mike Hilty wrote:

>Okay, I figured out that the issue is not due to the PHP code, but by the
>query I'm using against the MySQL DB...
>What I need to know is how to structure the code where the query is based
>off of fields filled in by the user.  I would like to structure the query
>where if the user provides a value for vendorNumber, and leaves the rest of
>the fields blank, the query would be "select * from changeLog where
>vendorNumber = '$vendorNumber';"
>The current query, when run in MySQL Control Center, gives the same behavior
>as on the website.
>Would I have to write this portion of the code in javascript, or some other
>client side scripting language to get the dynamic query built?
>Mike Hilty

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to