Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    Hi guys i'm hoping someone can help me I am witining a php script for my e-commerce site I am creating I am still quite new with how to obtain things for example I can't seem to be able to find my username in MySQL. Below is the sript I am using in php.
    PHP Code:
    $connect mysql_connect ("localhost""username""password"); 
    Where can I find out what my username is or is it something I have to register somewhere please help I am completly lost.
    Thanks in advance..

  2.  

  3. #2
    Junior Member _shady's Avatar
    Join Date
    Mar 2007
    Location
    Atlanta, GA USA
    Posts
    20
    Member #
    14934
    mysql_connect wants your MySQL username and password which is given to you by your web hosting provider. I host with GoDaddy, and they tell me what my MySQL username and password is. Basically just ask your web hosting company what they are or actually it should be listed somewhere in your web hosting control panel. Another thing or value you'll need is your hostname which is typically 'localhost'. Sometimes it's something else. Usually your MySQL setup page will show a sample mysql_connect string and you can find out your hostname there.

    Hope that helps!

  4. #3
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    Is there no other way to find my username as I am testing my scripts first and don't have the money to invest in hosting at the moment.?

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    If you are running mysql on your machine, I believe you can just give the username parameter the value root and skip the password.

    http://www.google.co.uk/search?hl=en...e+Search&meta=

  6. #5
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    Hi this doesn't seem to work here is what I used just so you can check my syntax is correct.

    PHP Code:
    $connect mysql_connect("locahost""root"""); 
    I have ran a test script to see if it works and I get the blank screen when viewing it through the browser, I am starting to think that I have installed everything incorrecty but if this statement is true then why can I still view my previous php scripts before this one.

  7. #6
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Are you sure MySQL is running?

  8. #7
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    localhost.

    Turn error_reporting all the way first: error_reporting(E_ALL);
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  9. #8
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    How woud I be abe to check that MySQL is running correctly? It is installed and I can acess it through its .exe and create databases in it this is why I am thinking that I have not installed/configured everything correctly.

    Here is my php script in full just incase its a syntax error
    PHP Code:
    <?php
    $connect 
    mysql_connect("localhost""root""") or
    die (
    "Hey dude check your connection");

    //create main db
    $create mysql_query("CREATE DATABASE IF NOT EXISTS moviesite")
    or die(
    mysql_error());

    mysql_select_db("moviesite");

    $movie "CREATE TABLE movie (
        movie_id int(11) NOT NULL auto_increment,
        movie_name varchar(255) NOT NULL,
        movie_type tinyint(2) NOT NULL default 0,
        movie_year int(4) NOT NULL default 0,
        movie_leadactor int(11) NOT NULL defaut 0,
        movie_director int(11) NOT NULL default 0,
        PRIMARY KEY (movie_id),
        KEY movie_type (movie_type,movie_year)
    )"
    ;

    $resuts mysq_query($movie)
    or die (
    mysql_error());

    //create "movietype" table
    $movietype "CREATE TABLE movietype (
    movietype_id int(11) NOT NULL auto_increment,
    movietype_label varchar(100) NOT NULL,
    PRIMARY KEY (movietype_id)
    )"
    ;
    $results mysql_query($movietype)
    or die(
    error_reporting(E_ALL));
    //create "people" table
    $people "CREATE TABLE people (
    people_id int(11) NOT NULL auto_increment,
    people_fullname varchar(255) NOT NULL,
    people_isactor tinyint(1) NOT NULL default 0,
    people_isdirector tinyint(1) NOT NULL default 0,
    PRIMARY KEY (people_id)
    )"
    ;
    $results mysql_query($people)
    or die(
    mysql_error());
    echo 
    "Movie Database successfully created!";
    ?>

  10. #9
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Did you try amending your previous code snippet? filburt1 indicated that you misspelled localhost

    PHP Code:
    $connect mysql_connect("localhost""root"""); 

  11. #10
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    Thanks for all the help guys but I decided to uninstall it all and install XAMPP from apache freinds as I have heard that it is very easy to get php/apache/mysql running correctly and am glad to report that it does as I loaded that php script and after debugging it, I had my echo message :-)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:31 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com