-1

I have the below code :

<?php 
    //Fetching the Category Name
    $sql="SELECT * FROM subcategory WHERE CategoryID='$catid'";
    $rs = mysql_query($sql) or die(mysql_error());
    while($row = mysql_fetch_array($rs)){   
?>
<a href="questions.php?scid=<?php echo $row['SubCategoryID']; ?>"><?php echo $row['SubCategoryName']; ?></a>
<?php } ?>

I have done a .htaccess file but still the rewrite is not working.

mysite/article.php?scid=9&page=1

I want them as mysite.com/categoryname_description_subcategoryname-1

Shehary
  • 9,926
  • 10
  • 42
  • 71
  • 1
    I think you got the rewrite url idea wrong – SuperDJ Aug 31 '15 at 17:14
  • If you can, you should [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) [statements](http://php.net/manual/en/pdo.prepared-statements.php) instead, and consider using PDO, [it's really not hard](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Aug 31 '15 at 17:16
  • [Your script is at risk for SQL Injection Attacks.](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) – Jay Blanchard Aug 31 '15 at 17:16

1 Answers1

0

You should alter the link names you've used in your design/html layout to the example I've posted below <a href="question/categoryname/categoryid.html"</a>

BeeFaauBee
  • 358
  • 1
  • 3
  • 10