- Tema Autor
- #1
soy nuevo en programacion web y necesito migrar una pagina a otro host pero no se como migrar la base de datos. el dueño del anterior host me dio un codigo para accesar a la base de datos pero no se como ingresar a ella, solicito apoyo para hacerlo.
este es el codigo:
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "tarjetaq155.db.8980565.hostedresource.com";
$username = "tarjetaq155";
$dbname = "tarjetaq155";
//These variable values need to be changed by you before deploying
$password = "your password";
$usertable = "your_tablename";
$yourfield = "your_field";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
//Fetching from your database table.
$query = "SELECT * FROM $usertable";
$result = mysql_query($query);
if ($result) {
while($row = mysql_fetch_array($result)) {
$name = $row["$yourfield"];
echo "Name: $name<br>";
}
}
?>
gracias de antemano
este es el codigo:
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "tarjetaq155.db.8980565.hostedresource.com";
$username = "tarjetaq155";
$dbname = "tarjetaq155";
//These variable values need to be changed by you before deploying
$password = "your password";
$usertable = "your_tablename";
$yourfield = "your_field";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
//Fetching from your database table.
$query = "SELECT * FROM $usertable";
$result = mysql_query($query);
if ($result) {
while($row = mysql_fetch_array($result)) {
$name = $row["$yourfield"];
echo "Name: $name<br>";
}
}
?>
gracias de antemano