bugmuncher Posted April 7, 2006 Share Posted April 7, 2006 Hello, all. I believe I am a newbie.In the following example, I'm trying to get 2 text fields out of my database, just to see what they are (and hopefully to use them!I figured I would use mysql_fetch_assoc to make an array of pairs of orgName and orgSuggestedCopy.But when I run the script, instead of getting whole records, I get "m" for both echos.I think I am approaching this the wrong way.--------------------$query="SELECT orgName, orgSuggestedCopy FROM organizations WHERE oid='$firstSub'";$result=mysql_query($query)or die ("Error");$debug="mysql_fetch_assoc($result)";echo $debug['orgName'];echo $debug['orgSuggestedCopy']; Link to comment https://forums.phpfreaks.com/topic/6795-php-mysql-result-processing-what-am-i-doing-wrong/ Share on other sites More sharing options...
wildteen88 Posted April 7, 2006 Share Posted April 7, 2006 Change this:[code]$debug="mysql_fetch_assoc($result)";[/code]to:[code]$debug= mysql_fetch_assoc($result);[/code] Link to comment https://forums.phpfreaks.com/topic/6795-php-mysql-result-processing-what-am-i-doing-wrong/#findComment-24699 Share on other sites More sharing options...
roland Posted April 8, 2006 Share Posted April 8, 2006 [quote name='bugmuncher' date='Apr 7 2006, 04:10 AM' post='362463']Hello, all. I believe I am a newbie.In the following example, I'm trying to get 2 text fields out of my database, just to see what they are (and hopefully to use them!I figured I would use mysql_fetch_assoc to make an array of pairs of orgName and orgSuggestedCopy.But when I run the script, instead of getting whole records, I get "m" for both echos.I think I am approaching this the wrong way.--------------------$query="SELECT orgName, orgSuggestedCopy FROM organizations WHERE oid='$firstSub'";$result=mysql_query($query)or die ("Error");$debug="mysql_fetch_assoc($result)";echo $debug['orgName'];echo $debug['orgSuggestedCopy'];[/quote]Try this...$query="SELECT orgName, orgSuggestedCopy FROM organizations WHERE oid='$firstSub'";$result=mysql_query($query, $link)or die ("Error");while($debug="mysql_fetch_assoc($result)){echo $debug['orgName'];echo $debug['orgSuggestedCopy'];}[/quote] Link to comment https://forums.phpfreaks.com/topic/6795-php-mysql-result-processing-what-am-i-doing-wrong/#findComment-24956 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.