/    Sign up×
Community /Pin to ProfileBookmark

update works one time not the second

below is called from a web page.

First time it is called $true varies from 1 to 0 depending on the results
of the mysql_query ( $ins) results.
Data is updated in foreclose.

Call the page after that true is always 0 and $cnt is 0.

$sel = “SELECT * FROM fidel” ;

$ret = mysql_query($sel);

while($arr = mysql_fetch_array($ret))

{
$sd=$arr[sale_Date];
$ts=$arr[tS_Number];
$ad=$arr[address];
$ct=$arr[city];
$st=$arr[state];
$cn=$arr[county];
$zp=$arr[zip];
$ap=$arr[aPN];
$su=$arr[status];
$no=$arr[nOS_Amt];
$op=$arr[open_Bid_Amt];
$sa=$arr[sold_Amt];
$sl=$arr[sale_Location];
$tr=$arr[trustee];
$tp=$arr[trustee_Phone];

$su=addslashes($su);
$sl=addslashes($sl);

$ins =”UPDATE foreclose SET Sale_Date=’$sd’ , TS_Number=’$ts’, Addr=’$ad’, Cty=’$ct’, St=’$st’,Zp = ‘$zp’, County=’$cn’,Status=’$su’,NOS_Amt=’$no’,Open_Bid_Amt=’$op’,Sold_Amt=’$sa’,APN_No=’$ap’,Sale_Location=’$sl’,Trustee=’$tr’,Trustee_Phone=’$tp’ WHERE APN=’$ap'”;
$result= mysql_query($ins);
if (!$result) {
die(‘Invalid query: ‘ . mysql_error());
}

$true=mysql_affected_rows();

echo “true -“;
echo $what;
echo “<br>”;

If ($what > 0 ) { $cnt=$cnt+1 ; }

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Hackaway spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...