Forum Topic: Displaying posts

(137 views • 12 replies)

This topic is 1 page long.

<< < > >>
None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 4/27/09 02:27 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

What I'm doing is similar to blog posts; I want to do something like this:

INSERT INTO updates VALUES ( "Title Test", "Body Test" )

Then have something like this on the main page:

<table><tr><td>Title Test</td></tr><tr><td>Body Test</td></tr></table>

And I'm working in PHP

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

DearonElensar

Reply To Post Reply & Quote

Posted at: 4/27/09 02:31 PM

DearonElensar LIGHT LEVEL 18

Sign-Up: 06/10/02

Posts: 1,731

SELECT queries and echo's, i won't write the code needed because it is really basic stuff and you are probably being lazy.

BBS Signature

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 4/27/09 03:10 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

No, I will have multiple blog posts, and I need to know how to show the last 5

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

WoogieNoogie

Reply To Post Reply & Quote

Posted at: 4/27/09 03:20 PM

WoogieNoogie LIGHT LEVEL 14

Sign-Up: 06/26/05

Posts: 3,284

Like he said...this is pretty much the first thing you learn if you've looked up MySQL and PHP.


None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 4/27/09 03:21 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

And I have yet to learn this. I can't find any good tutorials on it either. So I come here, and am redirected back to google?

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

TropicalPenquin

Reply To Post Reply & Quote

Posted at: 4/27/09 03:41 PM

TropicalPenquin FAB LEVEL 23

Sign-Up: 01/08/03

Posts: 4,954

At 4/27/09 03:21 PM, Super-Yombario wrote: And I have yet to learn this. I can't find any good tutorials on it either. So I come here, and am redirected back to google?

Yes, google. Giving it a couple of minutes of your time it always worth while.


None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 4/27/09 03:45 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

I tried Google before posting, I'm not an idiot :P

But that didn't come up, nor do I find it very helpful. I can't really understand it, and I don't see any PHP being used there at all

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

yhar

Reply To Post Reply & Quote

Posted at: 4/27/09 03:48 PM

yhar NEUTRAL LEVEL 03

Sign-Up: 04/02/08

Posts: 1,774

Programming is as much about the theory as it is about the actual typing.

You need a theory first, which for you is along the lines of: Select posts from database where the category there in is equal to the ID provided and limit the output to 5.

So, that would be

mysql_query("SELECT * from posts WHERE categoryid='$catid' ORDER BY ID DESC LIMIT 5");

So now you have your query, you need to manipulate the data, so you need to create a loop that goes through each post that matches the criteria provided through the query and echos the data. Look up: mysql selecting data, select WHERE, order by, limit and echo.

THIS IS CITRICSQUID POSTING


None

DFox

Reply To Post Reply & Quote

Posted at: 4/27/09 04:27 PM

DFox LIGHT LEVEL 30

Sign-Up: 08/09/03

Posts: 9,463

At 4/27/09 03:21 PM, Super-Yombario wrote: And I have yet to learn this. I can't find any good tutorials on it either. So I come here, and am redirected back to google?

After a few minutes searching, I found this: http://www.phpfever.com/mysqli-tutorial.
html

That's exactly what you want. It'll show you how to select data using mysqli extension. You could easily be lazy and just copy and paste his code or you could learn it. I highly suggest learning it.


None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 4/27/09 04:38 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

being as I'm not just going to be using this for one thing, I am forced to learn it

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

yhar

Reply To Post Reply & Quote

Posted at: 4/27/09 05:20 PM

yhar NEUTRAL LEVEL 03

Sign-Up: 04/02/08

Posts: 1,774

At 4/27/09 04:38 PM, Super-Yombario wrote: being as I'm not just going to be using this for one thing, I am forced to learn it

...I don't get why you posted then. I mean, surely you could have just done a search for php news system tutorial or similar and read how they do it and adapt it for your own use.

THIS IS CITRICSQUID POSTING


None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 4/27/09 07:57 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

I asked a friend and figured it out. Tutorials don't explain this stuff well enough for me I guess : /

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

DFox

Reply To Post Reply & Quote

Posted at: 4/27/09 08:24 PM

DFox LIGHT LEVEL 30

Sign-Up: 08/09/03

Posts: 9,463

At 4/27/09 07:57 PM, Super-Yombario wrote: I asked a friend and figured it out. Tutorials don't explain this stuff well enough for me I guess : /

Then go to your local book store, and buy a book. That's how I learned at first.


All times are Eastern Standard Time (GMT -5) | Current Time: 12:12 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!