Hey there. I've created the following code.php :
<html>
<body>
<?php
$db_host = "localhost"; // Server - mySQL
$db_user = "user"; // Login - mySQL
$db_pass = "pass"; // Password - mySQL
$db = mysql_pconnect($db_host, $db_user, $db_pass) or die (mysql_error());
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>
</body>
</html>
The code works fine when i run it on my machine
http://localhost/code.php
THIS WAS MY QUESTION:
My question is: I do have to upload the db I've created using mysql in my machine to my webserver to run the code there right? So how do I do it ? What file should I upload (db) to my webserver?
The localhost would be now http://www.server.com ??
I am asking this cause when I use asp I just have to upload the db.mdb but I saw that there are some other files inside
c:/apache/mysql/data/mydb such as employees.MYD,employees.MYI and employees(the db)
What should i change in my code to run at the webserver?
Thank you.
THIS WAS ONE ANSWER
Report this post to a moderator | IP: Logged
06-03-2003 03:42 PM
stolzyboy
Moderator
Registered: Sep 2002
Location: Fargo, North Dakota
Posts: 3042
you likely won't get access to the mysql to simply place the mysql tables file up on the webserver
simply put phpMyAdmin on your local machine
then do a mysql table data and structure dump on each one and then run an sql statement with that sql dump into the sql text box in phpMyAdmin and there ya go
I'd like to have that more detailed. Could any1 explain that to me please step by step??? What would be a sql dump into the sql text box ? etc..
I do have phpMyAdmin on my local machine.
THANKS.