Welcome Guest ( Log In | Register)



 
Closed TopicStart new topic
> What Value Would I Use To Insert This Data?, Help on insertion of data to database?
TheChosenDarknes...
post 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. =]
Go to the top of the page
 
+Quote Post
darran
post 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.
Go to the top of the page
 
+Quote Post
TheChosenDarknes...
post 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.
Go to the top of the page
 
+Quote Post
sonesay
post Mar 19 2008, 05:38 AM
Post #4


|||[ n00b King ]|||
*********

Group: [HOSTED]
Posts: 591
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.
Go to the top of the page
 
+Quote Post
jlhaslip
post 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 Icon

Group: [MODERATOR]
Posts: 3,744
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



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.
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Software To Restore Data(15)
  2. My Ipod Is Randomly Skipping Songs, Losing Data,(16)
  3. Import From Excel File Into Mysql Database(5)
  4. Can You Add Images Into A Mysql Database?(18)
  5. C Problem: "two Or More Data Types In Declaration"(4)
  6. Tales Of "insert Your Rpg Title" Game Collection(5)
  7. Truefusion Shoutbox(31)
  8. Get 30 Gb Email For Free(25)
  9. Data Can Be Stored On Paper(26)
  10. How Good Is This Data Cleaning Function?(2)
  11. Data Base For A War Game(5)
  12. Data Recovery Software(3)
  13. Data Structures -- Linked List -- Reverse(3)
  14. Data Recovery Program..help!(6)
  15. Vb Select Mysql Database(2)
  1. Treating .csv Files As Database Data(2)
  2. Mysql Database Space(3)
  3. Forum Database(9)
  4. Data On My Subdomain/webspace Vanished(1)
  5. What Is The Best Software(2)
  6. Php With Simple Csv List As Database, What Do U Think?(2)
  7. Best Free Online Game Database(1)
  8. Database With Mysql++(4)
  9. How Do I Connect To Live Database With Php Script?(6)
  10. Getting Started With Mysql(2)
  11. Transferring From Old Server To New Server "database And Forum" [resolved](5)
  12. Index In A Mysql Database(3)
  13. Ms-access Database Question(3)


 



- Lo-Fi Version Time is now: 13th May 2008 - 02:36 PM