Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS MySQL on Xampp

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32675
    Waffle
    Member

    I can’t seem to make my MySQL work… Ive got;

    
    
    mysql_connect(localhost,root,Jonny);

    $con = mysql_connect("localhost","","");

    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    if (mysql_query("CREATE DATABASE my_db",$con))
    {
    echo "Database created";
    }
    else
    {
    echo "Error creating database: " . mysql_error();
    }

    // Create table
    mysql_select_db("Practice_db", $con);
    $sql = "CREATE TABLE Persons
    (
    personID int NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(personID),
    FirstName varchar(20),
    LastName varchar(20),
    Age int
    Phone int
    )";

    // Execute query
    mysql_query($sql,$con);

    mysql_close($con);
    ?>

    Don’t know if its the username and password or not but can someone help me.. I would like to practice mysql with xampp

    #76909
    Waffle
    Member

    the username is root.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.