linstefoo Posted August 12, 2007 Share Posted August 12, 2007 Heres what I've got: product.html?id={SOMENUMBER} What I am trying for is to get the product url to look like this product{SOMENUMBER}.html and actually get the information based on that number from MySQL. I've tried a mod_rewrite that looks like this RewriteEngine On # mod_rewrite store directives RewriteRule ^product-([0-9]).html$ index.php?%{QUERY_STRING}&page=product&id=$1 [PT,L] I'm sure this is in the wrong area but who knows Any help would be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/64472-phpmysql-help/ Share on other sites More sharing options...
dbillings Posted August 12, 2007 Share Posted August 12, 2007 The first bit of code you wrote will produce a get variable and send it to product.html (Why not product.php?). Here's what I'd do based on what I interpret what you are trying to do. use a link to send a get variable to our page <?php echo "<a href='product.php?id=2">Product</a>" ?> Then on the product.php page <?php IF (isset($_GET['id'])) { $id = $_GET['id']; $table = // whatever the table name is in your database.; $sql = "SELECT product FROM $table WHERE id ='$id'"; $result = mysql_query($sql)or die(mysql_error()); $row=mysql_fetch_assoc($result); echo $row['product']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/64472-phpmysql-help/#findComment-321409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.