Dynamically linking to mysql to get results

I found this scrip and try to work on it for the last 3 days. It keep error out. I try to change a few things and I got it to connect to the database, but it will not work for me. This is to do dynamic linking from my database so when I click on the link it takes me to a different page as I add something to the database so I do not need to add links. This should be so easy but it just does not work. I just cannot figure out what I am doing wrong. Will someone look at this scrip and fix it for me. It is a two page process.
[php]<?php
//Query
$news_sql=“SELECT newsID, headline, author FROM news. ORDER BY NEWSID DESC”;
$news_query = mysql_query($news_sql) or die
$rsNews=mysql_fetch_assoc($news_query);
?>

"><?php echo $rsNews [headline];?> by <?php echo $rsNews ['author];?> <?php } while ($rsNews=mysql_feth_assoc($news_query))?> [/php] 2nd page newsarticle.php [php]<?php if(iiset($_GET['newsID])) { $newID=$_GET['newsID']; } else { $newID=1; }

//Query
$news_sql=“SELECT * FROM news WHERE newsID=$newsID”;
$news_query = mysql_query($news_sql) or die
$rsNews=mysql_fetch_assoc($news_query);
?>[/php]
I have tried to do this and that and I just cannot get it right. Can someone show me what I am doing wrong?

One problem is you spelled isset wrong. If you were using an ide with syntax highlighter you would have seen that. I highly recommend you find one that you like. Also use the PHP tags provided by the forum to highlight your code.

added the php bbcode. And as you can see, you’re missing a quote on <?php echo $rsNews ['author];?> and if(iiset($_GET['newsID])) {

Not sure if it’ll make a difference, but you may also consider switching to POST instead of GET.

Sponsor our Newsletter | Privacy Policy | Terms of Service