Welcome to WebmasterWorld Guest from 54.147.10.72

Forum Moderators: open

Message Too Old, No Replies

remote database question

use local db with dreamweaver so what next?

     

delboy1978uk

12:48 am on May 12, 2006 (gmt 0)

10+ Year Member



hi folks,

i have been mucking about on mysql on my home pc with dreamweaver using php

now i have bought hosting with a mysql database

questions:

1. when i set up the site in dreamweaver, do i use the local database or do i connect to the remote database?

2. the remote db is empty, how can i transfer tables over?

cheers :-)
del

[edited by: jatar_k at 5:48 pm (utc) on May 12, 2006]
[edit reason] no specific hosts thanks [/edit]

wheelie34

8:35 am on May 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try to just dump the local db (structure and data) to a .sql file then in phpmyadmin go to the db and either (if its a small file) copy n paste it into the sql command window, or below that browse for the file and upload, should work.

delboy1978uk

5:44 pm on May 12, 2006 (gmt 0)

10+ Year Member



yeah cheers but will the code for my pages still point to my local database? i want my local database to be used for testing on apache on my machine, then upload it to the remote site using the remote database

jatar_k

5:50 pm on May 12, 2006 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



take a look at your connection functions

mysql_connect

it should have the host in there, I am guessing it is set as localhost, if that is the case then you just need to look at your hosting and see if that setting is the same. If it is then you don't need to worry, it will work on both.

If there is a different setting you need to use on your host then you could use a config file on each that has the appropriate connection settings.

storevalley

5:53 pm on May 12, 2006 (gmt 0)

10+ Year Member



yeah cheers but will the code for my pages still point to my local database? i want my local database to be used for testing on apache on my machine, then upload it to the remote site using the remote database

Isolate the part of your script that connects to your db in a separate file. Have a copy on your server that connects to your remote db and a local copy that connects to your local db (just cloak this file in Dreamweaver so that it is ignored when you synch).

<edit>jatar_k beat me to it :)</edit>

delboy1978uk

9:54 pm on May 14, 2006 (gmt 0)

10+ Year Member



cheers for the info, so if the hosting server's mysql setup is set to localhost then they should both (local and remote) use their own databases?

obviously if not then the including the code from a seperate file would be a good idea, but i use dreamweaver to make the connection and design the pages, so how do you separate the connection code?

storevalley

1:13 pm on May 15, 2006 (gmt 0)

10+ Year Member



if the hosting server's mysql setup is set to localhost then they should both (local and remote) use their own databases?

Yes ... "localhost" will refer to the machine on which your script is running.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month