Jump to content

PHP & MySQL result processing: what am I doing wrong?


bugmuncher

Recommended Posts

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
Share on other sites

[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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.