SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Noob Question, Can this be done?

    Hey everyone, well this is my first post here so hello to everyone.
    Well im pretty much a noob to Databases and as my Background is mostly in GFX, i was wondering if this is possible.

    I want to make a database for a web game i play Battrick. The database will hold all players skills etc etc. But what i want to know is if its possible for me to be able to take text sections from a text field and add them into a Database like so.

    The user will paste this something like this into a text field, Just it will be alot longer:
    HTML Code:
    <td class="skillName">Bowling:</td>
    			
    				<td><a href="javascript:showLevels(12, 1);" class='norm'>remarkable</a></td>
    <td class="skillName">Consistency:</td>
    			
    				<td><a href="javascript:showLevels(13, 1);" class='norm'>wonderful</a></td>
    Is it possible to do it so that remarkable is added into the Bowling Table and Wonderful is added to the Consistency Table??

    Thanks for any help and letting me know if this is possible
    Thank you

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, but you have to write the code to make it work like that.

    Forum posts, blog comments, YouTube video descriptions... these are all user-inputted text being stored in a database.

  3. #3
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.

    So say if some one added this line of text into a text box:

    HTML Code:
    Stu Broomes (2297293)
    
    Stu is a RH Batsman and RH Spin Bowler. He is a cautious player with feeble leadership skills and woeful experience.
    
    He currently has proficient batting form, competent bowling form and energetic fitness.
    Plays For: 	Palmerston Nth City
    Nationality: 	New Zealand
    Age: 	20 Years Old
    Battrick Rating: 	116,747
    Wages: 	41,119 p/w
    Stamina: 	superb 	Wicket Keeping: 	superb
    Batting: 	wonderful 	Concentration: 	sensational
    Bowling: 	wonderful 	Consistency: 	wonderful
    Fielding: 	proficient 	
    I can write some code to extract parts of it and put into different feilds.
    Say i want to put wonderful into the Batting field?

    Any chance you can point to some tutorials or anything to read over?

    Thanks heaps for your help

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Look up "regular expressions". You would write a pattern (expression) that matches the text and captures the portion you want to extract ("wonderful" after "Batting:").

    Exactly how you do that depends on what language you're going to write your program in.

    Once you've extracted the text, you construct the database queries to insert it in the database.

  5. #5
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, ill start some research on expressions now

    and im going to use php and MYSQL

    thanks for the help and pointin me in a direction to start with

  6. #6
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ty php,net and other sites too, they offer good tutorial. Since you are a noob, so it will be slightly hard for you to understand, but they are really powerful function.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •