Jump to content


Photo

[SOLVED] PHP code not running


  • Please log in to reply
3 replies to this topic

#1 ali_kiyani

ali_kiyani
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts

Posted 22 August 2006 - 06:39 AM

Hi

I have an index.php page which contain some include files. When I run this page it doesn't run the PHP code. It just displays HTML code.
All images are being displayed dynamically by getting image name from database but it doesn't show any of the images. When I right click on image in IE and check its properties the image path is shown as

http://localhost/mysite/images/<? $image_name ?>

I tried running the code on IIS 5 (Win2K) and IIS 6(WinXP) but same problem.

Then I ran it on Linux but there it displays all the text in Chinese language (or some other) and also displays all the PHP code as it is without running it on server.

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 22 August 2006 - 07:07 AM

Silly question but, do you have php installed?

#3 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 22 August 2006 - 09:16 AM

If you have PHP with installed, you'l need to make sure you have the "short_open_tag" set to on as I notice you're using <? as an opening tag as opposed to <?php.

Assuming this is all ok then try:

http://localhost/mysite/images/<? echo "$image_name"; ?>

# Note the 'echo'

Regards
Rich
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#4 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 22 August 2006 - 09:24 AM

have you ensured that you have the file extensions right...ie does the imgae names have .jpg or .gif etc after them?
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users