This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-09-21 15:13:38

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Everything Web Code!

Okay, so this is a topic where I post all my web coding help! I currently need help with MySQL. I have made the database, and things, but I would like to know:
1. How to set something in a table to something.
2. How to add something to a table.
3. How to delete something from a table.
4. How to check if something in a table exists.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#2 2011-09-21 15:32:32

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Everything Web Code!

You can't tell me you've search for those and not found anything... they're all very simple commands!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2011-09-21 15:50:19

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: Everything Web Code!

Yes, but I don't understand any SQL, so i'd like somebody to explain to me better, rather than telling me to do it anyway.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#4 2011-09-21 19:09:01

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: Everything Web Code!

WHY DON'T YOU GOOGLE ANYTHING!!

Code:

UPDATE table SET nameOfRow=valueAfter WHERE nameOfCollum=valueBefore;
INSERT INTO table VALUES("string of first row", "string of second row");
DELETE FROM table WHERE nameOfCollum=valueOfRow;

And for the last one, a php code would be (after you connect)
NOTE: this is in a function

Code:

function getValue($table, $collum, $where){
$result = mysql_query("SELECT * FROM ".$table." WHERE ".$collum."='".$where."'") or die(mysql_error());
return mysql_fetch_array($result);
}

With the function, all you have to do is call this function and set it to a variable, then this code will turn the variable into an array, using the collum's name as the array [ ] thingy


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

#5 2011-09-21 20:46:57

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Everything Web Code!

If you don't understand any MySQL then you probably didn't spend the time to learn it.

LEARN IT.

Offline

 

#6 2011-09-21 22:36:28

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: Everything Web Code!

I Agree!!!


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

Board footer