Jump to content

Need Help About MYSQL


azeemgujjar

Recommended Posts

Hello!
    i m very bigginer with MySQL and php, actually i found many freescripts of php with mysql such as polling system, counter, mailing list.
    in all of scripts all coders only explain about using these scripts with mysql with single i mean only current system where i have mysql installed.
    but the problem is how will i upload the mysql database to my website? i don't know where is my database stored?? what is its extention??? and how will i explain its path to php scripts???
      i m using php5.2 and using mysql5

i want to tell you that my webhosting company supports mysql and php. and the settings which webhoster give me , i found there procted page MySQL database which supports to make database online, but what about the database which is in my system. :(

    Plz Plz Plz help me but remember i m very bigginer , give me information step by step
Thanks in advance
                                bye bye
Link to comment
Share on other sites

How to upload sql database to website:

If you backup your sql database that is running on your PC and edit the .sql backup file you will see the scripting that is used to recreate the database inclusing the table structure and the data within the tables. Using phpMyadmin that your web host provides for you you can execute these commands against the database you create by copying and pasting them into the SQL Query box.

How to connect to the database:

Your webhost will tell you the name of the server where your database is located and the name of your database and will allow you to create a user account in the database. With this information you can use this code to connect to your database in each script you write:

<?
# Database Connection Parameters
$dbhost = '[color=red][font=Verdana]localhost[/font][/color]';
$dbusername = '[color=red][font=Verdana]databasename[/font][/color]';
$dbpasswd = '[color=red][font=Verdana]*****[/font][/color]';
$database_name = '[color=red][font=Verdana]yourhost_yourdatabase[/font][/color]';
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
    or die ("Couldn't connect to server.");
$db = mysql_select_db("$database_name", $connection)
    or die("Couldn't select database.");
?> 

The information above that is in red font is the information you can obtain from your web host
Link to comment
Share on other sites

no dear i think you don't understand what i want to know!
now i m telling you step by step.
1) For example i make a mysql database with 2 tables on my pc.
2) now i want to know that where this database will be stores just like in MsAcces we have .mdb , this database file i will found where i will save, same as this where mysql database store????
3) now the important thing my as my host supports mysql and php, so where i will upload the mysql database and what is its extension??? how will tell the php that its database is in its own folder??? because we give path in msaccess program to its database.
  because in own personal computer we have mysql intalled and php get database path by default

            i hope you undertand what i want to know
i don't know if i botherd you but i openly want to tell you that i really don't know to more then making database and tables in mysql and working little with php. cuz i m learning php online tutorials.
          i hope you help me about uploading database of mysql and how php connect with it
but as i was told you that as i was visited my hosting control panel there i found to create user,database,tables..etc.
but if i have to follow thins online then what about the database which is in my pc????
Link to comment
Share on other sites

You cannot get the database files, like you can with MSAcces. Well you can but you wll corrupt your database. What you'll have to do is export your database by doing a MySQL dump into a text file. Yo  then upload that text file to your host and import it into your MySQL database.

You can easily do this by using PHPMyAdmin (you can get this from phpmyadmin.net for free). Login to PHPMyAdmin then go to your database and select the export tab at the top of the page. Now select the tables/export options and make sure the Save as file check box is selected 9at bottom of page). Now click the Go button and it'll now promt you to save the backup to your computer, save it to My Documents or your Desktop or summit

Now you have the backup you need to go to your host and login to your sites control panel and navigate your way to PHPMyAdmin (most hosts usually have this installed). Now create a new database with the same name you used on your PC. Once the database is created (with no tables) select the newly created database (if its not already) and go to the import tab. Now select the browse button on the import page and select the database backup you just made which should be in your My Documents or Desktop. It'll now upload that file and import the database from your PC.

Thats how you transfer MySQL databases.

If your host doesn't have PHPMyAdmin ask them how to import database backups into MySQL.
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.