Jump to content

String Function Problem


kjanceski

Recommended Posts

Hi. From this code i'm sending a value of a variable $con to javascrit script

 

 

<?php
Header("content-type: application/x-javascript");
$conn=mysql_connect("","","");
$sqlQuery="select * from forum";
mysql_select_db("",$conn);
$query=mysql_query($sqlQuery);
$r=mysql_num_rows($query);
if ($r<30 )
{
$g=$r-1;
$d=-1;
}
else
{
$g=$r-1;
$d=$g-31;
}

for ($i=$g;$i>$d;$i--)
{

$ime=mysql_result($query, $i,0);
$poraka=mysql_result($query, $i,1);
$vreme=mysql_result($query, $i,2);
$con=$con.'Poraka od:'.$ime.'<br>Vreme:'.$vreme.'<br>Poraka:'.$poraka.'<br><br>';
}
$con=trim($con);
$con = str_replace("\n", "", $con);
$con = str_replace("\r", "", $con);

echo 'var content="'.$con.'";';
?>

 

But when i open the page as a result i have message Object Window. This script i have tried at home on my WAMP server and work properly but when i upload it I have this stupid message. If you have the answer or any suggestion please help.

Link to comment
https://forums.phpfreaks.com/topic/55272-string-function-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.