issue:
$a = array("a" => "1", "b" => "2");
print_r($a);
output:
Array = ([0]=>'1'
[a]=>'1'
[1]=>'2'
[b]=>'2')
but what I want is like
Array = ( [a]=>'1'
[b]=>'2')
Any suggestions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Quote from the manual
Unless you tell mysql_fetch_array to return associative, then it will return both enumarated and associative entries for each column
specify MYSQL_ASSOC as the second argument to your mysql_fetch_array to fix this problem
In the longer term, I’d also recommend dropping mysql and using mysqli or even pdo