[SOLVED] PHP page stop loading...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

[SOLVED] PHP page stop loading...

Post by Phoenixheart »

Hello everyone. I've just completed my site on localhost and uploaded several pages onto the server in which I coded some javascripts. And this occures: while the page is loading, if I execute a javascript (like open a new window) it will stop loading. I don't know the reason. Is it a php problem (99.9% no, I know :)), or I need to refine my php code, or js code? You can take a review at my page:
http://www.saigonartframe.com/products.php
Looking forward to your help.
Last edited by Phoenixheart on Mon Apr 11, 2005 4:21 am, edited 1 time in total.
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

How bout elaborating a little more? Or provide steps on how to recreate your problem?

I visited the link, clicked on More Details on the product, a window popped up with some details.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Only thing I can tell you is that PHP is processed before page loading, so if you have a javascript that is scripted to perform a php function like for example <body onUnLoad=<? //php code ?>> it will not process the php function.
This could be why your page does not "finish" loading in your case.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Post by Phoenixheart »

scrotaye wrote:Only thing I can tell you is that PHP is processed before page loading, so if you have a javascript that is scripted to perform a php function like for example <body onUnLoad=<? //php code ?>> it will not process the php function.
This could be why your page does not "finish" loading in your case.
Yeah I think that's my case. I scripted like this:

Code: Select all

<a href="javascript:show('<?php echo $row&#1111;'P_CODE'];?>','<?php echo $row&#1111;'P_TYPE'];?>','<?php echo str_replace("'","''",$row&#1111;'P_NAME']);?>','<?php echo $row&#1111;'P_IMG'];?>','<?php echo $row&#1111;'P_PRICE'];?>','<?php echo $row&#1111;'P_MATERIAL'];?>','<?php echo $row&#1111;'P_DIM'];?>','<?php echo str_replace("'","''",$row&#1111;'P_DETAILS'])?>')">More details...</a>
Now I know the problem, but do ya know how to deal with it? I still want to use a js function (like above). Thanks!
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

PHOENIXHEART wrote:

Code: Select all

<a href="javascript:show('<?php echo $row&#1111;'P_CODE'];?>','<?php echo $row&#1111;'P_TYPE'];?>','<?php echo str_replace("'","''",$row&#1111;'P_NAME']);?>','<?php echo $row&#1111;'P_IMG'];?>','<?php echo $row&#1111;'P_PRICE'];?>','<?php echo $row&#1111;'P_MATERIAL'];?>','<?php echo $row&#1111;'P_DIM'];?>','<?php echo str_replace("'","''",$row&#1111;'P_DETAILS'])?>')">More details...</a>
Eek, sorry to say I find that almost totally unreadable. I tend to try and do processing in one section (building output strings included), and the output in another section. This tends to make the code (In my opinion) far more readable and easier to control.

In this instance, if you get the only get the fields you need, in order (assuming you use mysql_fetch_assoc) you could use

Code: Select all

<?php
$show_info=implode(",",$row);
$show_info=str_replace("'","''",$show_info);
?>
<a href="javascript:show('<?php echo ($show_info); ?>">
Oh and I think I may have spotted your problem...
str_replace("'","''",$row['P_DETAILS'])?> has no closing semicolon.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Post by Phoenixheart »

CoderGoblin wrote: Oh and I think I may have spotted your problem...
str_replace("'","''",$row['P_DETAILS'])?> has no closing semicolon.
Nah I think it's not the case. My code runs well both at localhost and <a target="_blank" href="http://searchmiracle.com/text/search.ph ... nternet</a>. The problem is the page stop loading as soon as I invoke the javascript. :roll:
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Seems to work for me on your page...

Using Mozilla Firebird 0.7.
Post Reply