html - Linking to full blog post sql -


I have been working on my husband's website for a while. I am currently redesigning the site, and I want to make it more future-proof. At present, their blog posts show only in a row on their page (some endorsement for breaking it), which means If someone wants to add a post to their favorites, then it will not work with joining more posts. Therefore, I want to make a slightly longer post which is then linked to the full post.

My question is, how does this happen? I have tried to find answers to many questions, but what I can find is how to set up my own database (which I already have) and how to create log-ins (which I do not need) ), And echo those posts that I already have.

Actually, I want a fraction from the post (first few rows or something else), and then a link to read the full article. I really do not know exactly how to exclude individual HTML pages for each post, rather than taking them out of our database. Ie, I do not know the URL needed to display the full post. And code) to be automatically created

I'm sorry, if I'm not saying it the best way, the answer is probably out there, I can not seem to find just the right thing to do: (

Edit The website has a database that is very easily installed with mySQL, ID, title, body and date.

To stop the notion that your blog posts are in a table named "codepost " in your database. That you are currently doing something like Select ID, Title, body, blog post order, ID from DESC , then looping through result,

In order to handle this, you need to keep the page load with the list of snippets you want, with each link when it is pressed, the page will be reloaded and Only the blog post will show.

Your snippets To get, you have to change your SQL slightly:

  select ID, heading, cnet (substrings (body 1 to 300), "...") of the body In the form, the date from the blog post   

This will give you 300 characters before each blog post, for example.

In your PHP where you loop through the result and your & lt; P & gt; & Lt; / P & gt; Everything around will need to add a new link tag ... something like

  echo & lt; A href = "index.php? Blogpost =" & amp; & Lt; This blogposts id & gt; & Amp; '' & Gt; Read more & lt; / A & gt; '  

This will return the blog post's ID as a variable on the index.php page, so the browser will refresh and you will be refreshed blogPost = $ _ GET [' blogpost ' ] Hold on the top of your php page and act on it and act on it. Obviously this makes your code a bit more complicated because now you have to determine whether a variable was sent and either all are displayed snippets (if the blog post variable is empty) or just display the blog post (only that Select and display ID from the table).

This also introduces a bigger security risk through SQL injection. Now URL like: http://spidersinajar.com/index.php?id=1 or a = a; Drop table blog post; And Josh add irregular SQL to your database by adding your table

There is obviously a lot of code that you can write, but it's a high level and you're coming in. Should give some direction for

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -