0

Erro Mysql_select_db()

criado por reeges em 29/07/2015 12:46pm
Boa tarde, sou iniciante em php e estou com esse problema se alguém puder me dar uma dica sobre este erro.



Segue abaixo meu código fonte :
<?php require_once('Connections/ipedapae.php');?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO iped (nome, cpf, datanascimento, endereco, complemento, bairro, cep, telefonemovel, telefonerecado, email, cidade, uf, profissao, localtrabalho) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($_POST['cpf'], "text"),
GetSQLValueString($_POST['datanascimento'], "date"),
GetSQLValueString($_POST['endereco'], "text"),
GetSQLValueString($_POST['complemento'], "text"),
GetSQLValueString($_POST['bairro'], "text"),
GetSQLValueString($_POST['cep'], "int"),
GetSQLValueString($_POST['telefonemovel'], "text"),
GetSQLValueString($_POST['telefonerecado'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['cidade'], "text"),
GetSQLValueString($_POST['uf'], "text"),
GetSQLValueString($_POST['profissao'], "text"),
GetSQLValueString($_POST['localtrabalho'], "text"));

$base= mysql_select_db($database_ipedapae,$ipedapae);
$Result1 = mysql_query($insertSQL, $base) or die(mysql_error());
echo '<script language="javascript">alert("Cadastro inserido com Sucesso!");</script>';
$insertGoTo = "HomeIpedApae.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
==================================================================
abaixo vou colocar meu código de banco de dados

# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"*/
$hostname_ipedapae = "bla bala bala";
$database_ipedapae = "u522807324_call";
$username_ipedapae = "u522807324_adm";
$password_ipedapae = "tal coisa e coisa e tal";
$ipedapae = mysql_connect($hostname_ipedapae, $username_ipedapae, $password_ipedapae) or trigger_error(mysql_error());

Lista de Respostas:

Nenhuma resposta foi publicada ainda.

Nova Resposta:

(Você pode usar tags como <b>, <i> ou <code>. URLs serão convertidas para links automaticamente.)