Jump to content

Most efficient and SEO friendly way to use database and php


Simber33

Recommended Posts

What would be the best way do implement this situation in php and mySQL:

I want users to be able to rate and review restaurants. This would mean that their ratings and reviews have to be inserted into the databse. This wouldn't be a problem. My question is, what is the most efficient and SEO friendliest way to show the ratings and reviews per restaurant.

Should I make a script that generate a page for each restaurant? Or should I have one page which gets the data from the database for each company (would that be SEO friendly).

 

Link to comment
Share on other sites

Yes you would get the info from the db and only use one page to echo out the info.  To help with the SEO part you would want to gather the db info before any output to the browser occurs so that you can set the title tag and description tag to something that corresponds to the info gathered.  SEO wise it really depends on what exactly you are trying to achieve when you mean SEO friendly.  SEO initially comes from the title and description tags but also the content on the page which will vary based on the content provided by the customer reviews. 

Quick example

<?php
$get = getReviews(); // make some function to return a db list of info for the given url parameters
?>
<html>
<head>
<title><?php echo (!empty($get['title'])) ? $get['title'].' | Default Text' : 'Default Text'; ?></title>
<meta name="description" content="<?php echo (!empty($get['description'])) ? $get['description'] : 'Default Descrption'; ?>"/>
</head>
<body>
<?php echo (!empty($get['review'])) ? $get['review'] : 'Sorry no reviews for that place';?>
</body>
</html>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.