Jump to content
Gary B

Data is coming out of MySQL as 'r' on my PHP page

Recommended Posts

I have the following columns in a MySQL database table:

StoryHeadline [varchar] 

StoryByline [varchar] 

StoryText [text]

In the database, the text appears correctly. In a previous page, when I use row["StoryHeadline"] the output appears correctly.

However, on my new page, where I'm using the ID from the previous page to pull just one specific row's data, I get the letter 'r' for output of all three of these fields. Here's the code:

Setting the variables:

$Headline = row["StoryHeadline"];
$ByLine = row["StoryByline"];
$StoryText = row["StoryText"];

Assembling the overall output:

$StoryRecap = $Headline . '<br />by' . $ByLine . ' ' . $TimeLine . '<br /><br />' . $StoryText;

Then when printing to the page:

<?php echo $StoryRecap; ?>

What I actually end up seeing:

Quote

r
by r Tue Jul 02, 1:01 am

r

How do I get my correct data to display? Thanks!

Share this post


Link to post
Share on other sites

What's actually in your results array when you dump it? 

Share this post


Link to post
Share on other sites

Looks to me like 'r' is being returned by your query.  Please post your query.

Share this post


Link to post
Share on other sites

$row is clearly a string that begins with "r". You will have to show the code that is assigning a value to $row.

Share this post


Link to post
Share on other sites

Check $row["StoryHeadline"] instead of row["StoryHeadline"] 

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...