Gary B Posted November 8, 2019 Share Posted November 8, 2019 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 rby r Tue Jul 02, 1:01 amr How do I get my correct data to display? Thanks! Link to comment Share on other sites More sharing options...
niche Posted November 8, 2019 Share Posted November 8, 2019 What's actually in your results array when you dump it? Link to comment Share on other sites More sharing options...
Gary B Posted November 8, 2019 Author Share Posted November 8, 2019 @niche when I try to just echo row["StoryHeadline"], I also get an 'r' but when I run the query directly on the database, the text appears correctly. Link to comment Share on other sites More sharing options...
niche Posted November 8, 2019 Share Posted November 8, 2019 Looks to me like 'r' is being returned by your query. Please post your query. Link to comment Share on other sites More sharing options...
Ingolme Posted November 10, 2019 Share Posted November 10, 2019 $row is clearly a string that begins with "r". You will have to show the code that is assigning a value to $row. Link to comment Share on other sites More sharing options...
niche Posted November 10, 2019 Share Posted November 10, 2019 Check $row["StoryHeadline"] instead of row["StoryHeadline"] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now