dsaba Posted June 7, 2007 Share Posted June 7, 2007 here is a query: $query = mysql_query("SELECT * FROM table WHERE field='$this'"); now I make an array from the results: $row = mysql_fetch_array($query); Yes I realize you can use a while statement to use associate keys to call on each row of the result, and then do something, but I specifically DO NOT WANT TO DO THIS Here I sum up the results: $total = mysql_num_rows($query); //lets say $total = 5 I now want to call a specific row # and then call a certain field from that row let's say a field is named 'whateverfield' so I want to say look in $row[0] and now look for the value of $row['whateverfield'] in this particular row can this be done? without a while statement? I want to do this for example: for ($i=0; $i<=$total; $i++) { //call an associative key from a specific row from the $row array } -thanks Quote Link to comment https://forums.phpfreaks.com/topic/54534-solved-using-both-numeric-keys-and-associative-keys-in-mysql_fetch_array/ Share on other sites More sharing options...
trq Posted June 7, 2007 Share Posted June 7, 2007 Maybe mysql_data_seek is what your looking for. Quote Link to comment https://forums.phpfreaks.com/topic/54534-solved-using-both-numeric-keys-and-associative-keys-in-mysql_fetch_array/#findComment-269745 Share on other sites More sharing options...
gtk Posted June 7, 2007 Share Posted June 7, 2007 Once I was thinking like you then I found a class to do this job I use a class that has a member function named adv_output() That Outputs the Following Array ( [0] => Array ( [id] => 2 [usr] => Sunanda [psw] => N2M0YThkMDljYTM3NjJhZjYxZTU5NTIwOTQzZGMyNjQ5NGY4OTQxYg== [sex] => male [age] => 18 [country] => India [occupation] => Same as Neel [about] => I am About To test it ) [1] => Array ( [id] => 3 [usr] => nbs [psw] => MDNkZTZjNTcwYmZlMjRiZmMzMjhjY2Q3Y2E0NmI3NmVhZGFmNDMzNA== [sex] => male [age] => 17 [country] => India [occupation] => Say Helo [about] => I am About To test it ) And it has also a output() function that Outputs Array ( [id] => Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 ) [usr] => Array ( [0] => Sunanda [1] => nbs [2] => girl [3] => new_girl ) I think you need the Second one. I've got it from http://zigmoyd.sourceforge.net/man/db.php#browse Quote Link to comment https://forums.phpfreaks.com/topic/54534-solved-using-both-numeric-keys-and-associative-keys-in-mysql_fetch_array/#findComment-269748 Share on other sites More sharing options...
Barand Posted June 7, 2007 Share Posted June 7, 2007 www.php.net/mysql_result Quote Link to comment https://forums.phpfreaks.com/topic/54534-solved-using-both-numeric-keys-and-associative-keys-in-mysql_fetch_array/#findComment-269793 Share on other sites More sharing options...
dsaba Posted June 8, 2007 Author Share Posted June 8, 2007 nice! solved Quote Link to comment https://forums.phpfreaks.com/topic/54534-solved-using-both-numeric-keys-and-associative-keys-in-mysql_fetch_array/#findComment-270478 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.