Jump to content

PHPMyAdmin -- Help needed


!!!!!

Recommended Posts

Okay, I have been trying out some MySQL stuff and, I cannot connect to MySQL. (Please don't call me stupid with this -->) I have thought that PHPMyAdmin was a MySQL Database, and I'm starting to think I was wrong. I don't know much about PHP but I'm trying to learn, and since I'm testing stuff out with MySQL, I really need to learn how to connect to it.

 

Either

A. Is PHPMyAdmin a MySQL Database (One of the reasons I think it isn't now is because it has 'PHP' in it instead of 'MySql' so I'm not totally stupid ( :) ))

or

B. Is there a way to check if I have a MySQL database?

 

If PHPMyAdmin isn't a MySQL Database, can you please tell me where I can get a free MySQL Database and how I set it up. All you have to say is if I just Upload it to my FTP or if there's another way I must do it.

 

Or, if PHPMyAdmin is a MySQL Database, can you please tell me how I find the port? I think I have my Username and Password right... As I log in with it into my PHPMyAdmin ON THE WEB THING. (Not through a PHP script, that's what doesn't work)

 

Thanks! Please tell me if you need some more info to answer my question. :)

Link to comment
Share on other sites

PHPMyAdmin is a simple interface for you to do stuff within MySQL. It isn't MySQL, it just helps you create databases, look into your databases, and modify them.

 

Try installing WAMP5. It is a complete PHP / Apache / MySQL installation.

Link to comment
Share on other sites

PHPMyAdmin is a simple interface for you to do stuff within MySQL. It isn't MySQL, it just helps you create databases, look into your databases, and modify them.

Oh, well is there a way I can find out my MySQL information, like the port, my Username, and my Password? I believe I know the Username and password, I'm just not sure about the port. In most cases I have tried 'localhost'.

 

---

 

EDIT: Well, I'd like to find out if I have a MySQL Databse already before I download WAMP5. :)

 

I have a database already in my PHPMyAdmin which leads me to think that I might have MySQL already installed.

Link to comment
Share on other sites

find my.cnf should tell you what you need to know.

 

If you know where mysql is installed to look at the data directory, that houses all the database plus tables inside those folders.

Okay... Well, this file would be in my FTP right? Also, if I have to download MySQL, would I just Upload that to my '/public_html' folder in my FTP? Or is there multiple steps of how to install MySQL?
Link to comment
Share on other sites

To connect to a database.

mysql_connect('host','user','password') or die("Error: Connection Problem.");
mysql_select_db('database');

 

PHPMyAdmin in a pice of software developed in php that work's with mysql.

Scripting is totally PHP.

How it stores data has to do with MySQL.

(come to think of it, I really do not know how PHPmyadmin stores the actual data.. Google..)

 

I suggest getting WAMP., it has Apache, PHP, MySQL, SQL Lite, PHPMyAdmin.

Link to comment
Share on other sites

PHP is one of many scripting languages running on the server.

 

MySQL is a database (among many) that stores data.

 

phpMyAdmin is a set of PHP scripts allowing you to interface with the MySQL database. The other way of accessing MySQL is through a CLI (Command Line Interface) and is a pain in the neck to use.

 

WAMP5 is a brilliant package that you can install onto your PC to turn it into a server for local work and is highly recommended unless you do what I do and upload scripts directly onto a remote server (web space!) and test/run them from there.

 

If you have web space which supports PHP there's a good chance it already has MySQL installed. You can find this out by uploading this small script:

<?php
  phpinfo();
?>

 

Once uploaded, access it and scroll down and it'll tell you what PHP has installed and if MySQL is installed.

 

Before you can connect to a database you need to create one via phpMyAdmin (or from your own PHP scripts) and also create a user and give it access rights.

Link to comment
Share on other sites

find my.cnf should tell you what you need to know.

 

If you know where mysql is installed to look at the data directory, that houses all the database plus tables inside those folders.

PHP is one of many scripting languages running on the server.

 

MySQL is a database (among many) that stores data.

 

phpMyAdmin is a set of PHP scripts allowing you to interface with the MySQL database. The other way of accessing MySQL is through a CLI (Command Line Interface) and is a pain in the neck to use.

 

WAMP5 is a brilliant package that you can install onto your PC to turn it into a server for local work and is highly recommended unless you do what I do and upload scripts directly onto a remote server (web space!) and test/run them from there.

 

If you have web space which supports PHP there's a good chance it already has MySQL installed. You can find this out by uploading this small script:

<?php
  phpinfo();
?>

 

Once uploaded, access it and scroll down and it'll tell you what PHP has installed and if MySQL is installed.

 

Before you can connect to a database you need to create one via phpMyAdmin (or from your own PHP scripts) and also create a user and give it access rights.

I have found my.cnf... It's file type is "SpeedDial"... Is that right?

 

Also, I try connecting to my MySQL database with my PHPMyAdmin User and Pass, and it doesn't work. I'm going to try the phpinfo().

Link to comment
Share on other sites

Are you running everything local on your machine or via web space?

 

Secdond, do you have access to cPanel?

Eh, I have no clue... All I know is that I have FTP and stuff.. I think it runs on my computer, considering whenever I go to my website, it says "Connecting to <my ip>". I started using this Web Hosting when I didn't know any HTML and stuff so I stuck with a random one, called vDeck... Sorry, I never looked that far into it.

 

All I know is I upload stuff to my FTP, and I have a Control Panel...

Link to comment
Share on other sites

http://img357.imageshack.us/img357/9916/cpanelej6.jpg

 

Circled red is access to the MySQL databse so you can create databases and users.

 

Circled green is a link to phpMyAdmin where you can admin your databases.

In my database section (note i'm not using the same thing as you), it has options: either A. Setup or B. Admin. Admin takes me directly to PHPMyAdmin, and Setup let's me add databases. All my databases for some reason have to start with "neomoonc_"...

 

Also let's me add users.

 

Oh lol, so users let's me add users so I can access the database?

 

<html>
<body>
<?php

$host = "localhost";
$user = "--edited--";
$pass = "--edited--";
$con = mysql_connect($host,$user,$pass);

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

mysql_select_db("neomoonc_p_bb1",$con);
$sql = "CREATE TABLE person (
firstname varchar(25);
lastname varchar(25);
age int;
)";

mysql_query("INSERT INTO person(firstname,lastname,age) VALUES('$_POST[firstname]', '$_POST[lastname]', '$_POST[age]'));

mysql_query($sql,$con);
mysql_close($con);?>
</body>
</html>

Mmm says there's an error on like 26...

Link to comment
Share on other sites

Yes. Once you add users to the database you must then assign permissions. Until you do this you won't be able to access the database using the user.

 

The permissions are basically like the ability to create tables, drop tables, alter tables etc. You should also have the option to add all permissions which is what I use while developing a site.

 

Once you have assigned permissions to a user you should then be given source in Perl and PHP to connect to the database using the user - just replace the default username and password with what you chose.

Link to comment
Share on other sites

Yes. Once you add users to the database you must then assign permissions. Until you do this you won't be able to access the database using the user.

 

The permissions are basically like the ability to create tables, drop tables, alter tables etc. You should also have the option to add all permissions which is what I use while developing a site.

 

Once you have assigned permissions to a user you should then be given source in Perl and PHP to connect to the database using the user - just replace the default username and password with what you chose.

It says I'm connected at --edited--@localhost, I put that port in the port spot in my code, and it's still not working. I made sure with the right username and everything.
Link to comment
Share on other sites

When posting connection code in public places, it's best to remove the username and password from your scripts. I'd go back and edit your post ;)

Ya, :), forgot about editing that out.

 

I got no errors with that, but I sorta forget how to show stuff in a table. :P Could you give me a snippet of code to show the stuff in that table please?

Link to comment
Share on other sites

No need for this line near the end as you're trying to create another table called "people"

mysql_query($sql,$con);

 

Here's some code to read the table:

<?php
  $query=mysql_query("SELECT * FROM people");
  while ($fetch=mysql_fetch_assoc($query)) {
    echo $fetch['firstname'].' '.$fetch['lastname'].' is '.$fetch['age'].'<br />';
  }
?>

 

That will go through all the rows and show the contents.

Link to comment
Share on other sites

No need for this line near the end as you're trying to create another table called "people"

mysql_query($sql,$con);

 

Here's some code to read the table:

<?php
  $query=mysql_query("SELECT * FROM people");
  while ($fetch=mysql_fetch_assoc($query)) {
    echo $fetch['firstname'].' '.$fetch['lastname'].' is '.$fetch['age'].'<br />';
  }
?>

 

That will go through all the rows and show the contents.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/neomoonc/public_html/mysql.php on line 26

 

Also, I added these things together:

<Html>
<head>
<title>MySQL Test</title>
</heaD>
<body>
<form name="input" action="mysql.php" method="post">
<input type="text" name="firstname"><br>
<input type="text" name="lastname"><br>
<input type="text" name="age"><br>
<input type="submit" value="submit">
</form>
</body>
</html>

and

<html>
<body>
<?php

$host = "localhost";
$user = "--edited--";
$pass = "--edited--";
$con = mysql_connect($host,$user,$pass);

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

mysql_select_db("neomoonc?p?bb1",$con);
$sql = "CREATE TABLE person (
firstname varchar(25);
lastname varchar(25);
age int;
)";

mysql_query("INSERT INTO person (firstname,lastname,age) VALUES ('".$_POST[firstname]."', '".$_POST[lastname]."', '".$_POST[age]."')");
?>

<?php
  $query=mysql_query("SELECT * FROM people");
  while ($fetch=mysql_fetch_assoc($query)) {
    echo $fetch['firstname'].' '.$fetch['lastname'].' is '.$fetch['age'].'<br />';
  }
?>
<?php mysql_close($con); ?>
</body>
</html>

And they won't add any tables or fields.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.