Jump to content


Photo

include php from mysql


  • Please log in to reply
7 replies to this topic

#1 marcus1060

marcus1060
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 November 2005 - 06:02 AM

I'm trying to output php from a mysql db, but instead you just see the php coding in the browser.
Help pls

#2 virtual_odin

virtual_odin
  • Members
  • PipPipPip
  • Advanced Member
  • 47 posts
  • LocationLondon, England

Posted 27 November 2005 - 08:34 AM

Show us your code. Immediate thoughts:
Have you started with <?php ?
Is the page name xxx.php ?
Have you sent headers?


#3 marcus1060

marcus1060
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 November 2005 - 11:14 PM

[!--quoteo(post=322412:date=Nov 27 2005, 03:34 AM:name=virtual_odin)--][div class=\'quotetop\']QUOTE(virtual_odin @ Nov 27 2005, 03:34 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Show us your code. Immediate thoughts:
Have you started with <?php ?
Is the page name xxx.php ?
Have you sent headers?
[/quote]

<?php: yes
xxx.php: yes
headers: no

The data is taken from mysql into a variable,
and then echoed:
echo "\n $summary";

I'm thinking the echo is the problem...

#4 opeth_nj

opeth_nj
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 November 2005 - 08:46 PM

[!--quoteo(post=322893:date=Nov 28 2005, 06:14 PM:name=marcus1060)--][div class=\'quotetop\']QUOTE(marcus1060 @ Nov 28 2005, 06:14 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
<?php: yes
xxx.php: yes
headers: no

The data is taken from mysql into a variable,
and then echoed:
echo "\n $summary";

I'm thinking the echo is the problem...
[/quote]

Try this.
echo $summary ."\n";

#5 marcus1060

marcus1060
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 29 November 2005 - 11:36 PM

That makes sense I'll give it a try.

Edit: Nope, doesn't work...
I'm thinking it might actually be some type of security thing I need to disable?

#6 virtual_odin

virtual_odin
  • Members
  • PipPipPip
  • Advanced Member
  • 47 posts
  • LocationLondon, England

Posted 03 December 2005 - 02:57 PM

Another xxx.php page displays correctly, yes?

Could it be that some of your global options are getting in the way? run PHP() and look at magic_quotes_gpc. I have just run up a test page and it works fine on my set up. magic_quotes ar off in my set up.

Also, try dropping the quotes and the \n and just echo the variable.

#7 marcus1060

marcus1060
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 04 December 2005 - 01:02 AM

[!--quoteo(post=324173:date=Dec 3 2005, 09:57 AM:name=virtual_odin)--][div class=\'quotetop\']QUOTE(virtual_odin @ Dec 3 2005, 09:57 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Another xxx.php page displays correctly, yes?

Could it be that some of your global options are getting in the way? run PHP() and look at magic_quotes_gpc. I have just run up a test page and it works fine on my set up. magic_quotes ar off in my set up.

Also, try dropping the quotes and the \n and just echo the variable.
[/quote]
Another xxx.php page displays correctly, yes?: yes

magic_quotes_gpc:
Had em on didn't work, had em off didn't work.

[a href=\"http://noveis.net/?page=php\" target=\"_blank\"]http://noveis.net/?page=php[/a] to see my php()

[a href=\"http://noveis.net/\" target=\"_blank\"]http://noveis.net/[/a] and view the source you'll see some php in the top article.

removing ."\n": no dice

#8 virtual_odin

virtual_odin
  • Members
  • PipPipPip
  • Advanced Member
  • 47 posts
  • LocationLondon, England

Posted 05 December 2005 - 06:54 AM

Could it be some nesting going on? Is your displayed bit of php within a string being echoed. I think this would achieve the result you are getting. You'd need to close the echo with "; before php would look for the next command otherwise it will just assume it is part of the echo.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users