NameSilo

Need some Simple Php tips to solve my problem

Spaceship Spaceship
Watch
Impact
35
hey guys
i got a script similar to a guest book that displays posts title under it description
please guys i need some help in enhancing it
i need to open each post in a new page containing more details which are fetched from the database (such as name age email bla bla bla bla )

the prob is that i dont know how to make the connection from the first page where the list of posts is and the other page which contain the details in a search engine friendly way
please guys i need some tips to fix that


Thanks in advance
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
An example....


In the display page, have each post ID link to something like:
Code:
<a href="./post-details.php?post=1">1</a>
Where 1 would be the current post ID (say from the loop retrieving the entries).


And on post-details.php, just have code that will pull the entry from the db by it's ID.
 
1
•••
umm though and tried that but is it Google friendly ?

i was thinking of makin something special with site name in url using post/name-of-site.html

btw
if i want just to get from the database from a specific field a certain number of characters i want to show like
i just want to show 200 characters of the description field how can i do this limit

also

how can i add Social Bookmark script that will dig a certain url :P (if possible)
 
0
•••
Alright, this is off the top of my head so try it out and let me know

To limit the characters of an entry you can do

Code:
$sql = "SELECT title, LEFT(description,200) AS pre_desc FROM table";

Now you'd call your description as pre_desc 
ex. echo $row['pre_desc'];

OR

Code:
substr($row['description'],0,200);


Both codes above will limit the text shown to 200 characters or any number of your choosing.

To make the URLs Search Engine Friendly or Google Friendly as you say you need to modify an .htaccess file with something similar to

Code:
RewriteEngine On
RewriteRule ^news/(.+).php post-details.php?post=$1

The htaccess part can be rewritten twenty different ways but thats probably the most basic, though maybe not the most efficient.

Any problems or any more questions feel free.

-Justin
 
1
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back