Forums Archive Index > Cool free scripts > Newsticker - PHP problem

Author: wolve69

Date: 22 Oct 2005 1:15 pm

Hi!

I have to connect the v_newsticker with a MySQL DB. In the "news.php" I write the PHP script for the output from the database.

I am really no PHP crack and al the time I get the error:
Quote:
Parse error: parse error in C:\xamp\xampplite\htdocs\pangerer\newscroller\news.php on line 11

I read some topics of this board and coded the following:

Code:
<?php require_once('../Connections/connAngerer.php'); ?>
  <?php
mysql_select_db($database_connAngerer, $connAngerer);
$query_rsNews = "SELECT * FROM news";
$rsNews = mysql_query($query_rsNews, $connAngerer) or die(mysql_error());
$row_rsNews = mysql_fetch_assoc($rsNews);
$totalRows_rsNews = mysql_num_rows($rsNews);
$ticker_output="";
while ($row_rsNews = mysql_fetch_assoc($rsNews));
$ticker_output="[".$row_rsNews['link'].",".$row_rsNews['short'].",".$row_rsNews['target']."]"
$ticker_output=substr($ticker_output,0,-1);
echo $ticker_output;
mysql_free_result($rsNews);
?>


Somewhere I have one or more mistakes, please help!

Thanks a lot,

wolve


Author: smartmenus

Date: 23 Oct 2005 4:37 pm

Just replace the following 2 lines:
Code:
while ($row_rsNews = mysql_fetch_assoc($rsNews));
$ticker_output="[".$row_rsNews['link'].",".$row_rsNews['short'].",".$row_rsNews['target']."]"

with
Code:
while ($row_rsNews = mysql_fetch_assoc($rsNews))
$ticker_output.="[".$row_rsNews['link'].",".$row_rsNews['short'].",".$row_rsNews['target']."]";

and it should work (if everything else is set correctly).