Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Erro Mysql_select_db e Mysql_qurery

$
0
0

Bom dia pessoal, sou iniciante em Php e to com esse erro aqui alguem pode me ajudar por favor :

 

erro :

 

Warning: mysql_select_db() expects parameter 2 to be resource, string given in /home/u522807324/public_html/HomeIpedApae.php on line 56

Warning: mysql_query() expects parameter 2 to be resource, null given in /home/u522807324/public_html/HomeIpedApae.php on line 57

 

--------------

 

o meu codigo fonte é este :

 

 

<?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($insertSQL,$database_ipedapae);    <------onde ocorre o erro
  $Result1 = mysql_query($insertSQL, $base) or die(mysql_error());  <-----onde ocorre o erro

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));
}
?>


Viewing all articles
Browse latest Browse all 14190

Trending Articles