Jump to content

mevukpaul

New Members
  • Posts

    2
  • Joined

  • Last visited

mevukpaul's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you so much mate. You've saved me a whole lot of agony! Anything I can do to say thanks?! p.s. I thought the code was a mess as I am a real novice with php/mysql. p.p.s For anyone using this solution, there are a few pieces of the code where there is an extra ( or a missing ; or something along those lines but once you get that sorted it works a treat.
  2. Hey guys, really hoping someone can help me with this I'll be extremely grateful! I am redesigning a website with a news archive type page using the mysql database from the previous version. The archive section contacts mysql and returns a number of values. In the archive section the previous version of the site uses a column called newsTitle to put information into the anchor url of the page which displays the full article. The problem is that there are duplicates in newsTitle. The previous website dealt with this by using php to add a suffix to the 1st duplicate of -0 , a suffix to the second duplicate of -1 and so on. I want to recreate this so I can keep the urls the same for seo purposes, otherwise I would just use the unique column newsID to seperate each article. Here's a simplistic version of my code so far. If anyone can come up with a way to add the suffixes to $title I will be soooo happy! Really appreciate your time and assistance. mysql_connect($host, $user, $pass) or die ("Unable to connect!"); @mysql_select_db($db) or die ("Unable to select database!"); $querytable="SELECT * FROM tblnews WHERE YEAR(newsDate) >= $startyear AND YEAR(newsDate) <= $endyear AND newsPageID = 13 ORDER BY `tblnews`.`newsDate` DESC"; $result=mysql_query($querytable); $sql = "SELECT * FROM tblnews WHERE YEAR(newsDate) >= $startyear AND YEAR(newsDate) <= $endyear AND newsPageID = 13 ORDER BY `tblnews`.`newsDate` DESC LIMIT $offset, $rowsperpage"; $result3 = mysql_query($sql, mysql_connect($host, $user, $pass)) or die ("Unable to connect!"); mysql_close(); $i= ($currentpage - 1) * 4; while ($list = mysql_fetch_assoc($result3)) { $title=mysql_result($result,$i,"newsTitle"); $url = strtolower ($title); ?> <div id="release"> <p> </p> <h3><a href="questionsarticle.php?pagetitle=<?php echo $url; ?>"><?php echo $title; ?></a></h3> <p> </p> </div> <?php $i++; }
×
×
  • 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.