Question/Awnser Project...PHP/MYSQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
anolan
Forum Newbie
Posts: 6
Joined: Tue Apr 18, 2006 11:47 pm

Question/Awnser Project...PHP/MYSQL

Post by anolan »

Hello everyone,

I'm somewhat new to php and mysql but I can hold my own. I've been asked to a project for a friend, he's not paying me or anything but he thought it would be a fun thing to do and I was thinking about how to go about doing it...

Someone would ask a question and it'd be stored in a database. He'd then go to a page and see the questions, he would then proceed to choose the questions he'd like to awnser (that are in the database) he would then reply to them, and the ones he chose would be displayed on another page with the original question and his reply.

I guess that would kind of be like a forum, but he only chooses to reply to the ones he wants and only the ones he wants would be displayed. Can anyone kind of lead me into the right direction of doing this?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

A journey of a thousand miles begins with a single step.

What do you have? What do you need help with? (be specific please)
anolan
Forum Newbie
Posts: 6
Joined: Tue Apr 18, 2006 11:47 pm

Post by anolan »

Wise words,

I've made a way so that people can send in the data and then the data be viewed on a different page. What I need help is, how do I make it so that my friend can choose from that data what he wants to be displayed on the other page, and also a way for him to reply to a single question, also, how could I have it so that the quetions he choose get rightly matched with the right response, because from the php and mysql that page I speak of that shows the data simply shows all the data in the column, my friend must pick and choose what he wants to respond to... now that I think about it I think it would be of benefit to show my ideas for the pages...

ask.php (would be where the people would ask their questions)
process.php (a php script to tell the question to go to the database)
display.php ( a page where my friend could view the questions)
respond.php ( a page where my friend would choose the questions he likes and then type his reply)
process2.php (a php script to tell my friend's question to get in the database)
home.php (a page where the questions he chose are displayed and matched with their appropriate response)


Hope this all helps
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Okay. So for the time being, ignore the database element. Hard code into an array or something a couple questions. Each question will have a unique number associated with them. Use that to your advantage by passing that to the answering page using, say a checkbox.

Once you get the data passing to the answering page, redisplay the question and add a <textarea> afterward (or before, whatever you like.) Now get this page submitting to another pseudo database insertion page. Once you get that all working, you can add database hooking.
anolan
Forum Newbie
Posts: 6
Joined: Tue Apr 18, 2006 11:47 pm

Post by anolan »

Yea exactly, but how do you assign numbers to indivual questions?
anolan
Forum Newbie
Posts: 6
Joined: Tue Apr 18, 2006 11:47 pm

Post by anolan »

and of course eventually I'll need a page that displays the question and the reply to the public, I think you added that in your summary but just to be sure...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Once set up correctly, the database's table will automatically generate the unique number for the questions. So for this first step, you can number them however you like so long as they are unique.
anolan
Forum Newbie
Posts: 6
Joined: Tue Apr 18, 2006 11:47 pm

Post by anolan »

so your saying that the database will take care of the numbering and I just need to do some php to call upon using this numbering? Sounds good, so where should I start?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I already told you where to start. :?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

anolan wrote:so your saying that the database will take care of the numbering and I just need to do some php to call upon using this numbering? Sounds good, so where should I start?
The database can auto-increment a number for you each time a question is added. There are other ways to do it but there's really no point in looking at them until you have some basics down ;)
anolan
Forum Newbie
Posts: 6
Joined: Tue Apr 18, 2006 11:47 pm

Post by anolan »

alright guys I'll start working on that and I'll let you know if I run into trouble, thanks
Post Reply