Stumped
Date: 05/01/05
(PHP Community) Keywords: mysql, sql
Code:
$TableNameADDR = "clients";
$Link = mysql_connect ($Host, $User, $Password);
$QueryADDR = "SELECT ClientFirst, ClientLast, PayorBillingAddress, PayorBillingAddress2, PayorBillingCity, PayorBillingState, PayorBillingZipCode, PayorBillingZipCodePlus4, InsCompany, InsAcctNum, service_notes, billing_notes, ClientRate, CGRate, dayrate from $TableNameADDR WHERE ClientID='$ClientID'";
$Result = mysql_db_query ($DBName, $QueryADDR, $Link);
if (!Result) {
print ("The Query could not be executed
\n");
echo 'Could not run query: ' . mysql_error() . "
$QueryADDR
";
}
while ($ROW = mysql_fetch_array ($Result)) {
$CLIENTaddress2 = array_values($ROW);
$ClientRate = $ROW[ClientRate];
$CGRate = $ROW[CGRate];
$dayrate = $ROW[dayrate];
}//end while
mysql_close ($Link);
Why is the result for CLIENTaddress doubled? (every value is in the array twice). I verified its only going through the while loop once.
Array
(
[0] => TEST DATA
[1] => TEST DATA
[2] => A_Curtis
[3] => A_Curtis
[4] => Market St
[5] => Market St
[6] => #321
[7] => #321
[8] => San Jose
[9] => San Jose
[10] => CA
[11] => CA
[12] => 95124
[13] => 95124
[14] => 3333
[15] => 3333
[16] => BandAid
[17] => BandAid
[18] => 1245
[19] => 1245
[20] => Testdata2
[21] => Testdata2
[22] => Testdata2
[23] => Testdata2
[24] => 40.00
[25] => 40.00
[26] => 20.00
[27] => 20.00
[28] =>
[29] =>
)
Source: http://www.livejournal.com/community/php/293566.html