Forum Moderators: coopster

Message Too Old, No Replies

Displaying php in html

         

philuk

1:45 pm on Aug 8, 2007 (gmt 0)

10+ Year Member



Firstly, I am programming novice.

I have a php search engine script, it works fine and gets results from a mysql database.

I was displaying the results in my html pages by way of server side parsing using php include. For some unknown reason after one year of faultless operation (I did not alter anything) it began to parse my results incorrectly. It would parse the wrong id number for data entries. For example it should have displayed id=3456, instead displayed id=17500 which did not exist.

I gave up trying to solve this problem and used an iframe to display the php search results. But I have been advised that many visitors could have disabled the display of iframes (iframes are being used to inject malware into visitors computers so more and more they will be blocked) into the browser.

Is there any other option to get my php script results to display in my html pages?, could I use javascript to display the results of my php script?

vincevincevince

1:46 pm on Aug 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IFRAMES are almost certainly not blocked, I've never heard of such a thing, especially not from the same domain.

Have you considered making your HTML file end in .php and then including the code directly as:
<?php
the code
?>
?

Habtom

1:50 pm on Aug 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of moving to frames, may be you can post part of the code where you think is the problem, and people here can look into it.

Habtom

1:50 pm on Aug 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



. . .and yeah, I almost forgot, Welcome to webmasterworld philuk

philuk

5:43 pm on Aug 8, 2007 (gmt 0)

10+ Year Member



thx for the welcome :)

I have not been able to understand why this error occurs.

At the moment I use this iframe code which works perfectly,

<iframe
src ="http://www.mysite.co.uk/t/search.php?q=sony&Submit=Search"
width="700" height="1500" scrolling="no"></iframe>

----------------------------------------------------------------------------------

Beforehand I was using this system without error for two years.

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.co.uk$ [NC]
RewriteRule ^(.*)$ [mysite.co.uk...] [R=301,L]
AddType application/x-httpd-php .htm .html
Addhandler application/x-httpd-php .html .php

Then this code within my pages,

<?php include('http://www.mysite.co.uk/t/search.php?q=sony&Submit=Search');?>

No problem.

But suddenly without any alteration to anything my end, the above php include throwed up this error,

Warning: main([mysite.co.uk ] ) [function.main]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/mysite/public_html/2.html on line 30

Warning: main([mysite.co.uk ] ) [function.main]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/mysite/public_html/2.html on line 30

Warning: main() [function.include]: Failed opening 'http://www.mysite.co.uk/t/search.php?q=sony&Submit=Search ' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mysite/public_html/2.html on line 30

But if I create a php include such as,

<?php include('http://www.mysite.co.uk/index.html');?>

It runs fine.

I can create a new html file like '3.html' and insert it into a php include and then the above error occurs. My server seems to like some urls and not others. And I cannot understand why.

No doubt it's something simple I've missed.

d40sithui

5:56 pm on Aug 8, 2007 (gmt 0)

10+ Year Member



seems like php cant access the file.
1)maybe its not there.
2)access rights to the file may be too high.
3)no idea