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
Share on other sites

First off, indentation is awesome.

 

Second, what is the exact message you are receiving? What is the PHP output of this file? Is your server running the same version of Windows and PHP that your local computer is running?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.