Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

45 users online



Few questions for a beginner

Few questions for a beginner

Currently viewing this thread: 1 (0 members and 1 guests)


Decker

Decker

Neverside Newbie
Status: Offline!

Few questions for a beginner

I just ordered the book on php/mysql made by phpfreaks. Anyway: I have a few things I want to ask not so I can reference when I actually get started in a couple days.

Here's the scenario: I want a visitor on my site to be able to upload a .txt file that is in a certain format. You know, where they click the browse button and find it. I'm not entirely sure how to do that, but I think I'll learn. The file will be in a format like this:

//NAME: Soldierks
// en-Kors
3 Soltari Guerrillas
// Land
13 Plains
1 Black Lotus
9 Mountain
// Other
SB: 3 Wing Shards

And I want to format it and store it in a database as well as have it ready to format into a small table on a page. I'm not even sure where to begin. No clue. I have a feeling this is a complicated script and maybe I won't have it done by febuary 20th. Anyhoo, I want the individual things to be stored as different variables I guess. You can see each line is clearly defineable by a common starting. How would I go about getting PHP to "narrow" it down to just the data that needs to be stored? for example, on lines starting with "// " how would I get jsut the text after that until the end of the line to be stored as one string?
Second question: how to store these separate things into a database?
Third: how to get it back from the database (output onto a page permanently) as:

<center><table border=2 cols=2 width=60% bordercolor=black cellpadding=0 cellspacing=0>
<tr bgcolor=AAF2AA><td colspan=2><b>Name: Soldierks</b></td></tr>
<tr bgcolor=AAF2AA><td colspan=2>en-Kors</td></tr>
<tr bgcolor=D3F9D3><td width=10%>3</td><td>Soltari Guerillas</td></tr>
<tr bgcolor=AAF2AA><td colspan=2>Deck Section Header</td></tr>
<tr bgcolor=D3F9D3><td width=10%>13</td><td>Plains</td></tr>
<tr bgcolor=D3F9D3><td width=10%>1</td><td>Black Lotus</td></tr>
<tr bgcolor=D3F9D3><td width=10%>9</td><td>Mountain</td></tr>
</table></center>

___________________

I did the atkins diet for only two weeks, and I lost 14 days!

"Decker, your sig still.." rocks
Love, Phil

swish

swish

Status: Offline!

why dont u just use a form with input fields in it?

___________________

Graphic and Web Design services at flowtone.com

Decker

Decker

Neverside Newbie
Status: Offline!

Quite possibly the most worthless reply I've ever gotten.

___________________

I did the atkins diet for only two weeks, and I lost 14 days!

"Decker, your sig still.." rocks
Love, Phil

its1am

its1am

Ugh... Leave this blank for now
Status: Offline!

1. Learn the code yourself
2. No one is just gonna give you the code that will do that.
3. Nuff said

I see your doing something with mtg. it would be simpler to do a form.

make your form and with the form you want

Code:


<form method=post action=actionpage.php>

Then make your form like

Code:


Card Name:<input type=text name=name01> How many copies<input type=text name=copy01 value=1>

--------------------------------

then on your actionpage.php

PHP:


<?
   
if (isset(name01)) { // if they typed in something for that card
      
$card1 name01;
   }

After you check all the fields, you then make a script taht enters it into database.

___________________

...

Decker

Decker

Neverside Newbie
Status: Offline!

Look chump, I was NOT asking for a script. I was asking if anyone could point me in the right direction of the functions I need to learn. I don't want a script that's easier to make, I want a script that's best for my visitors. I plan on doing the manual enter as well.

So, basically my question for the moment is:
What function(s) can I use to decipher each line for interpretation?

___________________

I did the atkins diet for only two weeks, and I lost 14 days!

"Decker, your sig still.." rocks
Love, Phil

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0079 seconds.