Results 1 to 6 of 6

Thread: PHP/MySQL newbie help.

  1. #1
    MoonMan's Avatar

    ZeroPaid Regular

    Join Date
    May 2002
    Location
    Dearborn
    Posts
    3,923

    PHP/MySQL newbie help.

    Hey everyone, I just got a reliable webhost that supports php and mysql and everything is already installed blah blah blah and basically I want to use it. I've been following webmonkey's tutorial and I hit a bump in the road early on and was hoping for someone to lead me down this blind alley.

    Basically I am having trouble creating a database, which is explained very vaguely on this page.

    Anyway, let's get on with the database. For Win32 users, I'm sorry, but this requires some DOS work. You'll have to use a DOS window or type everything in the Run window. Don't forget to type in the path to the location of the MySQL/bin directory with your commands. Unix users can work from the MySQL bin directory, but you may have to start each command with ./ so the programs run.

    The first thing we need to do is create the actual database. From the command line, type:

    mysqladmin -u root create mydb
    That creates a database called "mydb." The flag tells MySQL that we're doing this as the root user.

    Next we'll add some data using everyone's favorite example, the employees database. We're going to need that dump file I mentioned earlier. If you're interested in how it goes together, review the manual that comes with MySQL or check out http://www.turbolift.com/mysql/.

    Copy and paste the following text to a file and save it in MySQL's bin directory. (I'll call the file mydb.dump.)



    CREATE TABLE employees ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');

    INSERT INTO employees VALUES (2,'John','Roberts','45 There St , Townville','Telephonist');

    INSERT INTO employees VALUES (3,'Brad','Johnson','1/34 Nowhere Blvd, Snowston','Doorman');


    If the lines wrap, make sure that each insert statement is on a new line. Now we'll insert it into the mydb database. From the command line, type:


    mysql -u root mydb < mydb.dump


    You shouldn't get any errors doing this. If you do, check for incorrect line wrapping.
    The first part about using the command prompt is what threw me off. Mostly because they don't tell me WHAT THE HELL I DO WITH IT. Do I upload a text file with the information ? Why don't the commands they give me work in the command prompt ? Is there a step I am passing over ? Why am I so dumb ?

    You can tell I'm a newbie huh? Well anyways, I need someone to basically spoon feed me through this and I would appreciate it deeply. Thanks in advance.
    “Workingmen of Europe feel sure as the American War of Independence initiated a new era of ascendancy for the middle class, so the American Antislavery War will do for the working classes.” - Karl Marx

  2. #2
    simian's Avatar

    ...still evolving...

    Join Date
    Jun 2003
    Location
    Orlando, Florida
    Posts
    117
    CREATE TABLE employees ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');
    If you have access to phpMyAdmin, you would enter the above command as an SQL query. ( There is an ovbious spot for this... just cut and paste into this.)
    You can also make a .sql file and importing it into phpMyAdmin that way.

    Here is the linke for that:http://www.phpmyadmin.net/
    Please help me get my free IPod and get one for yourself also!
    http://www.freeipods.com/default.aspx?referer=8786054

    Fodder Forums --- Get Your Fill.

  3. #3
    simian's Avatar

    ...still evolving...

    Join Date
    Jun 2003
    Location
    Orlando, Florida
    Posts
    117
    Oh, one more thing: Your ISP may have not supplied you with phpMyAdmin.. They should, but they might not.

    If they don't, there are other programs that make quick work out of sql queries and general database management.

    SQLyong is one that comes to mind.

    ~~~~~Click Me~~~~~

    It looks like the new version is shareware or some shyte but I have included a slightly older freeware version if you want to check it out.
    Attached Files Attached Files
    Please help me get my free IPod and get one for yourself also!
    http://www.freeipods.com/default.aspx?referer=8786054

    Fodder Forums --- Get Your Fill.

  4. #4
    MoonMan's Avatar

    ZeroPaid Regular

    Join Date
    May 2002
    Location
    Dearborn
    Posts
    3,923
    Originally posted by simian
    Oh, one more thing: Your ISP may have not supplied you with phpMyAdmin.. They should, but they might not.

    If they don't, there are other programs that make quick work out of sql queries and general database management.

    SQLyong is one that comes to mind.

    ~~~~~Click Me~~~~~

    It looks like the new version is shareware or some shyte but I have included a slightly older freeware version if you want to check it out.
    No no you misunderstand, my webhost (a very nice guy who is hosting my page for me) has everything fully installed and set me up with an account. I'm not sure what you are giving me, but I do not think it is the answer I need.

    What I want is a more DETAILED way to do this:

    Anyway, let's get on with the database. For Win32 users, I'm sorry, but this requires some DOS work. You'll have to use a DOS window or type everything in the Run window. Don't forget to type in the path to the location of the MySQL/bin directory with your commands. Unix users can work from the MySQL bin directory, but you may have to start each command with ./ so the programs run.

    The first thing we need to do is create the actual database. From the command line, type:

    mysqladmin -u root create mydb
    That creates a database called "mydb." The flag tells MySQL that we're doing this as the root user.


    Once I actually figure out how to input that data properly or use the command prompt to do it properly, I think I will be ok.
    “Workingmen of Europe feel sure as the American War of Independence initiated a new era of ascendancy for the middle class, so the American Antislavery War will do for the working classes.” - Karl Marx

  5. #5
    simian's Avatar

    ...still evolving...

    Join Date
    Jun 2003
    Location
    Orlando, Florida
    Posts
    117
    The first thing we need to do is create the actual database. From the command line, type:

    mysqladmin -u root create mydb
    That creates a database called "mydb." The flag tells MySQL that we're doing this as the root user.
    Well phpMyAdmin and the proggy I sent you are designed do exactly what this is trying to do. i.e. create databases without going into DOS prompts. If this guy has everything set up for you, he also should have phpMyAdmin at your disposal. It really helps. The instructions you posted look like a nightmare.

    Anyway, sorry if this is still not helping. This is just how I set up my databases.
    Please help me get my free IPod and get one for yourself also!
    http://www.freeipods.com/default.aspx?referer=8786054

    Fodder Forums --- Get Your Fill.

  6. #6
    .::BeatFactory::.'s Avatar

    The man, the myth,...

    Join Date
    Dec 2002
    Location
    Houston, TX
    Posts
    738
    All of this reminds me of the good old days before cPanel X...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •