Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá Pessoal, seguinte, fiz um site em PHP e publiquei, só que quando tento acessar aparece a seguinte mensagem: "No database selected" e tbm não estou conseguindo fazer a conexão com o banco de dados seguem os códigos:
Conexão Banco de dados:
<?php
$hostname_sekh = "localhost";
$database_sekh = "database_nome";
$username_sekh = "usuário";
$password_sekh = "senha";
$sekh = mysql_connect($hostname_sekh, $username_sekh, $password_sekh) or trigger_error(mysql_error(),E_USER_ERROR);
?>
Código página inicial:
<?php require_once('Connections/sekh.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_Rinformacoes = 1;
$pageNum_Rinformacoes = 0;
if (isset($_GET['pageNum_Rinformacoes'])) {
$pageNum_Rinformacoes = $_GET['pageNum_Rinformacoes'];
}
$startRow_Rinformacoes = $pageNum_Rinformacoes * $maxRows_Rinformacoes;
mysql_select_db($database_sekh, $sekh);
$query_Rinformacoes = "SELECT * FROM informacoes ORDER BY id DESC";
$query_limit_Rinformacoes = sprintf("%s LIMIT %d, %d", $query_Rinformacoes, $startRow_Rinformacoes, $maxRows_Rinformacoes);
$Rinformacoes = mysql_query($query_limit_Rinformacoes, $sekh) or die(mysql_error());
$row_Rinformacoes = mysql_fetch_assoc($Rinformacoes);
if (isset($_GET['totalRows_Rinformacoes'])) {
$totalRows_Rinformacoes = $_GET['totalRows_Rinformacoes'];
} else {
$all_Rinformacoes = mysql_query($query_Rinformacoes);
$totalRows_Rinformacoes = mysql_num_rows($all_Rinformacoes);
}
$totalPages_Rinformacoes = ceil($totalRows_Rinformacoes/$maxRows_Rinformacoes)-1;
mysql_select_db($database_sekh, $sekh);
$query_Rdisponiveis = "SELECT * FROM disponiveis ORDER BY id DESC";
$Rdisponiveis = mysql_query($query_Rdisponiveis, $sekh) or die(mysql_error());
$row_Rdisponiveis = mysql_fetch_assoc($Rdisponiveis);
$totalRows_Rdisponiveis = mysql_num_rows($Rdisponiveis);
?>
Alguém, por favor, poderia me ajudar?
Agradeço desde já a atenção de vcs...
Carregando comentários...