tsilenzio Posted August 2, 2007 Share Posted August 2, 2007 If i want to get just a single field information from a row how would i do it? For example: Query im useing: "SELECT userName FROM users WHERE userID = '$userID' AND userName = '$userName'" I was trying not to use mysql_fetch_row or mysql_fetch_assoc because that uses an array and I need just one field from a single row Link to comment https://forums.phpfreaks.com/topic/63057-query-help-mysql-functions/ Share on other sites More sharing options...
piznac Posted August 2, 2007 Share Posted August 2, 2007 mysql_fetch_assoc will only pull one record if thats all that matches the query. It will still be in an array,. but there will only be one record. Link to comment https://forums.phpfreaks.com/topic/63057-query-help-mysql-functions/#findComment-314043 Share on other sites More sharing options...
dooper3 Posted August 2, 2007 Share Posted August 2, 2007 stick "LIMIT 1" at the end of the mysql query. though you may still need to use mysql_fetch_row or mysql_fetch_array i'm afraid. Link to comment https://forums.phpfreaks.com/topic/63057-query-help-mysql-functions/#findComment-314046 Share on other sites More sharing options...
tsilenzio Posted August 2, 2007 Author Share Posted August 2, 2007 okay thanks also how do u fetch mutiple rows? like will one of the functions do it? or must i use a loop? =/ Link to comment https://forums.phpfreaks.com/topic/63057-query-help-mysql-functions/#findComment-314062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.