|
|
|
|
![]() ![]() |
Mar 18 2008, 04:41 PM
Post
#1
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 15 Joined: 12-March 08 Member No.: 59,224 |
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
CODE <?php // Make a MySQL Connection mysql_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): CODE <?php if(count($_POST) > 0) { $changepage = $_POST['changepage']; // do any extra formatting you need to the string var $changepage here // output it back here echo " <tt>$changepage</tt> "; } ?> <form action="pasture.php" method="post"> <TEXTAREA class="text" name="changepage" COLS="80" ROWS="15"> <?php echo "$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. =] |
|
|
|
Mar 19 2008, 03:26 AM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 658 Joined: 31-August 06 From: Singapore Member No.: 29,189 |
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.
|
|
|
|
Mar 19 2008, 05:26 AM
Post
#3
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 15 Joined: 12-March 08 Member No.: 59,224 |
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. |
|
|
|
Mar 19 2008, 05:38 AM
Post
#4
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 593 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
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.
|
|
|
|
Mar 19 2008, 05:50 AM
Post
#5
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,749 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
See your other thread.
http://www.trap17.com/forums/index.php?s=&...st&p=380106 Also notice that I have closed this topic. You have 3 about the same issue. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 15th May 2008 - 03:15 PM |