Remnant data from previous queries when using mysql_fetch_array...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
    I am a novice PHP dev having a strange issue with mysql_fetch_array.
For some reason, it is keeping data from previous queries in the array, and
displaying it in the web page.
    My development platform is Win2k SP2, Apache 1.3.23, PHP 4.3.0,
MySQL-MAX 3.23.47-nt.
    Here is the code that I am using:

<?php
// open database connection
$connection = mysql_connect(localhost, username, password) or die ("Unable
to
connect!");

// select database
mysql_select_db(vendorNameChange) or die ("Unable to select database!");

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

if ($row = mysql_fetch_array($result)) {

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

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

// close database connection
mysql_close($connection);

?>

    I am looking for a way to initialize the array, and display only the
data returned from the current query on the page.  Any help with this would
be greatly appreciated.

Thanks,
Mike Hilty






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux