Jump to content
xisto Community
TheChosenDarkness

What Value Would I Use To Insert This Data? Help on insertion of data to database?

Recommended Posts

I am learning slowly but surely and I know some of you probably getting tired of my questions. ^^;; However, I believe one can not learn without asking questions. So.. if I get too bothersome.. just point me to some books or something. lol XD

<?php// Make a MySQL Connectionmysql_connect("localhost", "name", "password") or die(mysql_error());mysql_select_db("at2927_abq") or die(mysql_error());// Insert a row of information into the table "example"mysql_query("INSERT INTO members (pasture) VALUES('Timmy Mellowman', '23' ) ") or die(mysql_error());   echo "Data Inserted!";?>

Okay, what Value or Values do I need to put? I am making a page decorator for my registered users and I want the text to "stick" to the page. I was told I would need to "insert" the data and the "retrieve" the data in order for it to stick. So.. what Value(s) would I use?Here is the form I created (with help of course):

<?phpif(count($_POST) > 0){$changepage = $_POST['changepage'];  // do any extra formatting you need to the string var $changepage here // output it back hereecho " <tt>$changepage</tt> ";}?><form action="pasture.php" method="post"><TEXTAREA class="text" name="changepage" COLS="80" ROWS="15"><?phpecho "$changepage"?></textarea><br><input type="submit" value="Change"></form>

So I want to take the submitted data and make it "stick" to the page. So what would be the Value for the database to store and then for me to retrieve?Hoping I got the database set up right for this type of insertion and retrievial. =]

Share this post


Link to post
Share on other sites

Not sure if I understood your question right, by values do you mean what kind of datatype you need to use for your specific columns in your table? If that is the case, a good choice to use would be varchar, but then again it would be wise to set limits on the number of characters which could be stored as it would cause some huge process overhead in the long run when there are a huge number of users using this form.

Share this post


Link to post
Share on other sites

Okay, I am trying to get "layout" content to insert into a database and then "retrieve" it. So it will stick on the page I want it to. However, I am not sure what to tell the code to insert. I have a form and I basically want the form insert "text" into the database.For example.. where the name and age is on the example.. what would I put there to tell the code to "insert" the layout data?---To better phrase the question: How do I get to form to insert the data into the database? Much like you do with registering users, except I want to insert text. Like in layouts or stories, etc. That way I can retrieve it and have it "stuck" to the page until I user wants to change it.

Share this post


Link to post
Share on other sites

When you say layout content are you referring to html tags and what ever else content the user inserts into the form then submits? If that is the case and you want to store it to be retrieved later you will need a database table setup to accept the submitted text area by the user.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.