TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-23-2009, 07:50 PM   #1 (permalink)
The Visitor
 
Join Date: Jun 2009
Posts: 4
Thanks: 0
woowoo is on a distinguished road
Default SEO Friendly URL, Fetched from Databse Category Id etc..

Ok Im an aboslute noob and dont even know if my title is on target for what I want to do.

I have a script here that creates categories etc, it's all PHP and something like ZenCart, OScommerce etc but with it I want to know how to turn it around to have SEO friendly URL's.

WhenI enter a category or product Id in the back office it I assume it stores them in the ?databse? so in aassuming that they are stored in there as category1 and product 2 and so forth.

This is the code used to call the category ID to the page.

Code:
if(!empty($_GET[CategoryID]))
{
	$query[] = " ItemCategory = '$_GET[CategoryID]' ";
}
Here is the code on the admin page that is used to enter the category ID to the database.

Code:
<?
require_once("../conn.php");
require_once("access.php");
require_once("../includes.php");
require_once("AdminNavigation.php");

if(isset($_POST[s1]))
{
	if(!empty($_POST[categoryname]))
	{
		$q1 = "insert into dd_categories set
				CategoryName = '$_POST[categoryname]' ";
		$r1 = mysql_query($q1);

		if(mysql_error())
		{
			$error = "<span class=BlackLink>The category name <font color=black>$_POST[categoryname]</font> already exist!</span>";
		}
	}
	else
	{
		$error = "<span class=BlackLink>Enter the New Category name, please!</span>";
	}
}

?>

<br>
<center>

<span class=BlackLink>Add a new category</span>
<br><br>

<form method=post>
<table align=center width=350>
<caption align=center><?=$error?></caption>
<tr>
	<td align=right>New Category name:</td>
	<td><input type=text name=categoryname size=20></td>
	<td><input type=submit name=s1 value="Add"></td>
</tr>

</table>
</form>

<?

$q1 = "select * from dd_categories order by CategoryName";
$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) > '0')
{
	echo "<br>";

	echo "<table align=center width=300 cellspacing=0><caption align=center><span class=BlackLink>Categories List:</span></caption>\n<tr class=TableHead>\n\t<td>Categories</td>\n\t<td align=center>Action</td>\n</tr>\n\n";
	
	$col = "white";

	while($a1 = mysql_fetch_array($r1))
	{
		if($col == "white")
		{
			$col = "dddddd";
		}
		else
		{
			$col = "white";
		}

		echo "<tr bgcolor=$col>\n\t<td align=left>$a1[CategoryName]</td>\n\t<td width=100 align=center><a class=GreenLink href=\"EditCategory.php?CategoryID=$a1[CategoryID]\">edit</a> | <a class=BlackLink href=\"DeleteCategory.php?CategoryID=$a1[CategoryID]\" onclick=\"return cdel('$a1[CategoryName] category');\">delete</a></td>\n</tr>\n\n";
	}

	echo "</table>";
}
?>
My ultimate goal is to get the url of category and on the product pages to be the name that I give the product or category.

I chose this question because ultimately it is going to help me understand the admin panel, moving stuff to a databse and linking together code.

I look forward to a response.

Thank you everyone.
woowoo is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Category Problem codyodell MySQL & Databases 4 06-07-2008 08:47 PM
Category and order Jonnee Absolute Beginners 6 12-23-2007 09:58 PM
Category System Tutorial Gurnk Tips & Tricks 14 12-10-2007 05:24 AM


All times are GMT. The time now is 02:23 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design