Jump to content

weirdest problem ive encountered..


Rifts

Recommended Posts

ok what in the world is going on here...

 

I have a simple javascript code to switch out the text between a div there are 4 rotations

 

the text that is being switched is populated from my DB using php.

 

now the weird part.

 

in my DB i'm using longtext now If the text in the db is all one paragraph everything works fine but if there is any type of line break or new paragraph the script wont rotate at all.

 

any ideas?

Link to comment
Share on other sites

No no errors at all.

 

here is the code.. so yeah if i change ANY of the 4 text fields and add a break at all it just doesn't rotate.

<?

include 'dbconfig.php';

$result = mysql_query(" SELECT * FROM featured where active='2' ");
while($row = mysql_fetch_array($result))
	  {
			$text2 = $row['text'];
			$img2 = $row['image'];
	  }
$result = mysql_query(" SELECT * FROM featured where active='3' ");
while($row = mysql_fetch_array($result))
	  {
			$text3 = $row['text'];
			$img3 = $row['image'];
	  }
$result = mysql_query(" SELECT * FROM featured where active='4' ");
while($row = mysql_fetch_array($result))
	  {
			$text4 = $row['text'];
			$img4 = $row['image'];
	  }
$result = mysql_query(" SELECT * FROM featured where active='1' ");
while($row = mysql_fetch_array($result))
	  {
			$text1 = $row['text'];
			$img1 = $row['image'];
	  }
	  
	  
?>

<script type="text/javascript">

var test=new Array();
  test[0]='<?= $text2; ?>';
  test[1]='<?= $text3; ?>';
  test[2]='<?= $text4; ?>';
  test[3]='<?= $text1; ?>';


var speed=5000;
var q=0;

function showQuote() {

     document.getElementById("tests").innerHTML=test[q];
     q++;
if(q==test.length) {
     q=0;
  }
}
setInterval('showQuote()',speed);

</script>
   

 

for example if i change one of the text fields from

 

hello, welcome to my site

 

to

 

hello,

welcome to my site

 

 

it breaks it

 

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.