WRITE the text in a DIV into a MYSQL DATABASE? help!

Hey,
I’m just really starting to learn php and I learned how to write the contents of a form into a mysql database, but i’m curious how I would write the contents of 3 different DIVs into a mysql database.

Let’s say I have 3 DIVS, I have URL, NAME, and DESCRIPTION. Those are 3 seperate DIVS on a page that I want to write into a mysql database.

basically i’m trying to allow people to save bookmarks into their profile page, so when they click a button titled “bookmark this” on an article page, it writes the url of the page, the name of the article, then the description of the article. So all 3 of these values will be predefined by me.

agh, help please?

give an id to every article, and then just save that id in the db.

that’s what I’m trying to figure out how to do, how would I do that?

whats ur db-structure right now?
just for me to know where to start explaining.

This would seem like a good time to interject…

I believe if you read the sticky at the top of the beginners board stating ->
Helpful Guides For Beginners and Advanced Users -
http://www.phphelp.com/forums/viewtopic.php?t=7837

I was gonna figure that out once I learned how to write text that isn’t in a form to it.

well i’m trying to display a table on a users profile page that shows the ARTICLE NAME, CATEGORY, DATE PUBLISHED, and URL.

So the data that I want to save into the mysql database is all in different DIVs.

<DIV id="article_name">THIS IS THE ARTICLE NAME</DIV>

then i have a button down below

[code]


[/code]

How do i get the button to grab the data from the article title DIV, etc.

I hopes this helps clarify, i’m rather lost… ugh.

I looked at that but only had more questions, i also searched google and this forum, forgive me for my suck-ness.

u can’t.

u need to have a db-stucture first.

of case u could use:

<input type="hidden" name="article_name" value="THIS IS THE ARTICLE NAME">

but if u store that article name in a MySQL db. u just need to submit it’s id.

<input type="hidden" name="article_id" value="42">

it’s always the first thing to make ur datastructure (database, classes, vars).
and the second stepp is to write the code. it wount work the other way aroud.

i see,

curious,
I have many users that have to sign in, i want each of them to be able to save pages they like from my website to their private profiles.

my question is this: what’s the best way to format this?

I can save and read from my mysql database, I just don’t know exactly the best way to format this, every user will have many bookmarks, would I make 4 rows? USER_ID, ARTICLE_NAME, ARTICLE_URL, ARTICLE_DESCRIPTION?? but wouldn’t that be redundant? all 8,000 members could bookmark the same article and it would be written into the database 8,000 times. Is this how other people do it? or should it be that every article is entered into the mysql database, and then when their private profile loads, it reads the row that verifies they have an account, and in that row are the numbers of the article ID?, so for instance, in the mysql database would be a file that holds the passwords, user names, and other information for each user, in a column in this users row would be a column named SAVED_ARTICLE_IDs and inside that would be (example)
107 2 9 8 3 79 45
and it would grab the articles that had those specific ARTICLE_IDs…

or am i just way off?

gah… i’m confused

3 table:

article: ID, DESCRIPTION …

user: ID, NAME, …

bookmarks: ID, USER_ID, ARTICLE_ID

Sponsor our Newsletter | Privacy Policy | Terms of Service