How do I set a value to something in a Database?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mythic Fr0st
Forum Contributor
Posts: 137
Joined: Sat Dec 02, 2006 3:23 am
Contact:

How do I set a value to something in a Database?

Post by Mythic Fr0st »

How would I say

connect to mysql

then create table, and add lists...

and $strlvlelf=1 but in the database? so it has a value
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Moved to PHP-Code.
Mythic Fr0st
Forum Contributor
Posts: 137
Joined: Sat Dec 02, 2006 3:23 am
Contact:

err

Post by Mythic Fr0st »

Err sorry, just woke up, forgot this was a php code thingy

(basically im asking how do I set a value to it)
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

You ask how to update an entry in the DB?

Code: Select all

UPDATE `table` SET `column1` = 'value' WHERE `column2` = 'something'
SQL tutorial in w3school: http://www.w3schools.com/sql/default.asp
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: err

Post by RobertGonzalez »

Mythic Fr0st wrote:Err sorry, just woke up, forgot this was a php code thingy

(basically im asking how do I set a value to it)
What have you done so far? Try something first then post when your code doesn't work as expected.
Mythic Fr0st
Forum Contributor
Posts: 137
Joined: Sat Dec 02, 2006 3:23 am
Contact:

hmm

Post by Mythic Fr0st »

Nothing yet, all i know about MySQL is how to add em etc..

I wanna add a value to a certain thing before entering it...

E.G

elf has 4 strength

I wanna create the table 'elf'

and put
strlvlelf=4
into the database (Not update)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Might a suggest you get a book, read through that, try some stuff then ask for help with what you are trying? In the meantime, look at these functions and see how you can apply those to your app.

mysql_connect()
mysql_select_db()
mysql_query()
mysql_affected_rows()
mysql_fetch_array()

Also look through the MySQL manual at http://www.mysql.com for table structure syntax, field types, data types, SELECT, INSERT, UPDATE and DELETE queries. Learn a bit of this stuff first, then we can help you really learn how to use it.
Post Reply