School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / mysql101 ![]() |
Week #1 Basic To-Do Assignment, post here |
(#1 2003-08-08 08:52:46) Post Reply |
|
TDavid
|
Welcome to the Script School MySQL course!
Your Week #1 Basic TO-DO assignment should be posted here in this thread only. If you have specific questions about the week 1 course text then please also post them in this thread so that other students can learn from the information and we can collectively build a knowledge base. Here is the details on what you need to do in this assignment: Basic To-Do Assignment for Week #1: Use the tools available on your host or PHP to create a test Database and connect to it. Share the complete source code you are using to connect to the database (for the username and password just use "username" and "password", do not actually supply your real username and password when posting here for obvious security reasons). |
(#3 2003-08-09 03:25:35) Post Reply |
|
pstarwars
|
Your link to the week 1 class text doesn't work:
The requested URL /mysql101/w1.phtml was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. |
(#4 2003-08-09 20:48:13) Post Reply |
|
TDavid
|
er, the link ... where? LOL Would be helpful to know which page and where it was wrong so I could fix.
course text is at: http://class.scriptschool.com/...ql/101/w1.phtml |
(#5 2003-08-09 20:52:37) Post Reply |
|
TDavid
|
It was missing the directory slash on the summary page and the mySQL directory page, which I've fixed. I've also added to the main page a link (which wasn't there) to the course material. We'll be looking forward to seeing assignments from folks ;) |
(#6 2003-08-09 21:10:59) Post Reply |
|
TDavid
|
We discussed this on the radio show yesterday and I said I'd create a thread to work this out.
When should we have the IRC workshop? Date and time (use PST, EST or GMT in suggestions, please) I'm thinking maybe Tuesday nights 7pm PST / 10pm EST. Any suggestions of other times? |
(#7 2003-08-12 04:37:33) Post Reply |
|
lizabit
|
Makes little difference to me as I am in Oz and am seldom around when others are viewing. But if you're asking... 3:00am (GMT) makes it 1:00 pm in Melbourne Australia and 8:00pm in Seattle and 11:00pm in Washington DC..?
Whatever way you go, if you keep the logs up for viewing its terrific, other users usually have the same questions. (Usually sooner than I but there you go.) Thanks for everything Regards Liz |
(#8 2003-08-12 15:24:35) Post Reply |
|
Donnie
|
I completed the week 1 basic assignment. I don't really know what I need to post here, but it is complete. |
(#10 2003-08-13 10:12:18) Post Reply |
|
pstarwars
|
Done.
http://members.lycos.co.uk/tda...1basic/show.php |
(#11 2003-08-13 23:23:39) Post Reply |
|
lizabit
|
created db on server using the phpmyadmin supplied onsite.
Regards Liz |
(#13 2003-08-15 11:09:39) Post Reply |
|
TDavid
|
Donnie -- and others, you need to do as the instructions say above, please:
quote: |
(#14 2003-08-15 11:13:26) Post Reply |
|
TDavid
|
There was one person at the workshop on Tuesday night 7pm PST / 10pm EST besides Logspirit and I. We're going to try this again on Tuesday Aug 19, 2003 at 7pm PST / 10pm EST.
The point of the workshop is to review the assignment and for students to be able to ask questions relating to the course text. I know that Week 1 wasn't all that hard, but it would be nice to see attendence at the next workshop chat. We moved the time because we felt that evenings would make it easier for part time folks to show up. The chat is located in the official Script School commons at: irc.scriptschool.com #scriptschool Or via java chat at: http://www.scriptschool.com/commons/ Week 2 course text and assignment will be posted following today's live radio show at 2pm PT / 5pm ET. Hope to see all there that can make it. |
(#20 2003-08-18 23:17:11) Post Reply |
|
lizabit
|
(revised)
//Connect to MySQL server: $dbh = mysql_connect("localhost", "******", "******") or die("Could not connect:". mysql_error()); //now connect to database mysql_select_db("test", $dbh) or die("Could not Connect to database". mysql_error()); //write query to create the table $query_create_table = "CREATE TABLE shoppinglist ( id MEDIUMINT(8) UNSIGNED NOT NULL auto_increment, shoppingday DATE NOT NULL default '000-00-00', cookies TINYINT(4) UNSIGNED NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM"; //implement table $result_create_table = mysql_query($query_create_table,$dbh) or die("Could not Create Table:". mysql_error()); print("Table Created"); ?> |
(#31 2003-09-02 23:34:49) Post Reply |
|
logspirit
|
Liz, it looks OK
logspirit |
(#32 2003-09-03 15:17:51) Post Reply |
|
Donnie
|
I installed phpdev423 on my machine several weeks ago when I began trying to learn php. I don't currently have a server available with database capabilities - other than my local machine.
I used phpmyadmin to create a database I then used the following script to connect to the server and then to the database. |
(#35 2003-09-04 05:22:56) Post Reply |
|
logspirit
|
Donnie,
From the MySQL Manual: http://www.mysql.com/doc/en/Ge...l_security.html Try mysql -u root. If you are able to connect successfully to the server without being asked for a password, you have problems. Anyone can connect to your MySQL server as the MySQL root user with full privileges! Review the MySQL installation instructions, paying particular attention to the item about setting a root password. From the Manual: http://www.mysql.com/doc/en/Security.html shell> mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('new_password') -> WHERE user='root'; mysql> FLUSH PRIVILEGES; Either run the above from the shell command or translate it to SQL statements and run it through PHP, or do it through phpMyAdmin. It is a major security vulnerability to be running the MySQL server under 'root' without a password!!! Any privileges that MySQL has on Your machine to read files, can then be hacked into by anyone who can gain access to Your machine. While this may not seem like a big deal in a learning set-up, and You may not have any files that need protection yet (such as Your special project ideas) it is not a good practice to establish! Please see the MySQL manual's security and privilege grant sections. You should add a user name and password appropriate to each use. And as I answered in the week #1 basic assignment forum, You then have to restart the MySQL server. Thank You for causing this topic to be discussed! logspirit |
(#41 2003-09-17 17:04:55) Post Reply |
|
Shrek
|
Here is my Week#1 Basic To Do Assigment
|
(#42 2003-09-17 22:22:00) Post Reply |
|
logspirit
|
Shrek,
Looks good, Welcome to the course! I hope You will also try to attend the LIVE Tuesday Night Chat Workshops that take place at 10:00 EST, 7:00 PST .... From http://www.scriptschool.com/commons/ Chat Instructions: Accept the applet, {And be patient!!! Java Applets can take a while to load!!!} You can also use your favorite IRC client by pointing to: irc.scriptschool.com port 6667 #scriptschool logspirit |
(#65 2004-02-12 14:40:04) Post Reply |
|
koolguy
|
?php
// This will connect me to my sever: $db = mysql_connect("localhost","vzccorpc", "linuxuser") or die("Could not connect:". mysql_error()); print("Connected successfully"); /* I will now create a DATABASE CREATE DATABASE [IF NOT EXISTS] db_name */ // I will now use php ceate the database: $query_create_db = "CREATE DATABASE IF NOT EXISTS shoppinglist"; // And then implement it: $result_create_db = mysql_query($query_create_db,$db) or die("Could not Create Database:". mysql_error()); print("Database Created"); //This is what threw me off, how can i connect to a database if one does not, exist, I kept getting the error that I was not allowed into the database mysql_select_db("shoppinglist",$db) or die("Could not Connect to database:". mysql_error()); print("Connected to Database"); /*I connected to table but was not allowed to create the database, I can create it using PHPmyAdmin, but what is the point if i am not going to be able to create it remotely using php*/ $query_create_table = "CREATE TABLE shoppinglist ( id MEDIUMINT(8) UNSIGNED NOT NULL auto_increment, shoppingday DATE NOT NULL default '0000-00-00', cookies TINYINT(4) UNSIGNED NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM"; // And Implement it: $result_create_table = mysql_query($query_create_table,$db) or die("Could not Create Table:". mysql_error()); print("Table Created"); ?> |
(#66 2004-07-13 17:54:20) Post Reply |
|
shogun
|
<?
// Connect to my MySQL server DONE: $db = mysql_connect("localhost", "username", "password") or die("COULD NOT CONNNECT:". mysql_error()); print("Connected Successfully"); /*THE SYNTAX FOR DATABASE CREATION IN MySQL is: CREATE DATABASE [IF NOT EXISTS] db_name DONE */ // SO IN PHP WE CAN USE THE FOLLOWING QUERY: DONE $query_create_db = "CREATE DATABASE IF NOT EXISTS solmioco_base"; //AND THEN IMPLEMENT IT, DONE: $result_create_db = mysql_query($query_create_db,$db) or die("Could not Create Database:". mysql_error()); print("DATABASE CREATED"); //BEFORE WE CAN USE A DATABASE, WE HAVE TO CONNECT TO IT, DONE: mysql_select_db("solmioco_base",$db) or die ("Could not Connect do database:". mysql_error()); print("Connected to Database"); // THEN WRITE A QUERY TO CREATE A TABLE, DONE: $query_create_table = "CREATE TABLE shoppinglist ( id MEDIUMINT(8) UNSIGNED NOT NULL auto_increment, shopping DATE NOT NULL default '0000-00-00', cookies TINYINT(4) UNSIGNED NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM"; //AND IMPLEMENT IT, DONE: $result_create_table= mysql_query($query_create_table,$db) or die("Could not Create Table:".mysql_error()); print("Table Created"); /* For the full CREATE TABLE syntax, see the MySQL manual: http://www.mysql.com/doc/en/CREATE_TABLE.html */ ?> |
(#67 2005-02-01 03:01:11) Post Reply |
|
AndreV
|
Here is the code:
<? // Connect to MySQL server: $db = mysql_connect("host","username", "password") or die("Could not connect:". mysql_error()); print("Connected successfully<br>"); /*Select and connect to database that is already present on the server*/ mysql_select_db("media-axis_co_za_-_mediadb",$db) or die("Could not Connect to database:". mysql_error()); print("Connected to Database"); ?> And here is a link to the server: www.media-axis.co.za/http://www.media-axis.co.za/connectweek1.php And thank you for the course!! |
(#68 2005-08-27 12:48:28) Post Reply |
|
hyster
|
is this ok as a 1st script?
|
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission