Olá pessoal estou com um problema na minha galeria,já tentei de tudo e mais um pouco ,mas não consegui resolver o problema, tentem me ajudar. Bom essa galeria está funcionando perfeitamente no localhost, mas quando eu coloco na web, as vezes ele inclui uma imagem e as vezes não, quando ele não inclui a imagem aparece o seguinte erro """Erro na inserção no banco de dados No database selected"""" buenas vou mandar o script para vocês olharem, dem uma olhada o que está de errado. é meio extenso mas aee vai esse é meu cadastro_imagem.php <?php require_once('Connections/vania.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .=&". htmlentities($_SERVER['QUERY_STRING]); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']==true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = "1"; $MM_donotCheckaccess = "false"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && false) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "logar.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck= . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?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; } } $currentPage = $_SERVER["PHP_SELF]; $maxRows_RsGaleriaFotos = 10; $pageNum_RsGaleriaFotos = 0; if (isset($_GET['pageNum_RsGaleriaFotos'])) { $pageNum_RsGaleriaFotos = $_GET['pageNum_RsGaleriaFotos']; } $startRow_RsGaleriaFotos = $pageNum_RsGaleriaFotos * $maxRows_RsGaleriaFotos; mysql_select_db($database_vania, $vania); $query_RsGaleriaFotos = "SELECT * FROM tbimagens ORDER BY idImagem ASC"; $query_limit_RsGaleriaFotos = sprintf("%s LIMIT %d, %d", $query_RsGaleriaFotos, $startRow_RsGaleriaFotos, $maxRows_RsGaleriaFotos); $RsGaleriaFotos = mysql_query($query_limit_RsGaleriaFotos, $vania) or die(mysql_error()); $row_RsGaleriaFotos = mysql_fetch_assoc($RsGaleriaFotos); if (isset($_GET['totalRows_RsGaleriaFotos'])) { $totalRows_RsGaleriaFotos = $_GET['totalRows_RsGaleriaFotos']; } else { $all_RsGaleriaFotos = mysql_query($query_RsGaleriaFotos); $totalRows_RsGaleriaFotos = mysql_num_rows($all_RsGaleriaFotos); } $totalPages_RsGaleriaFotos = ceil($totalRows_RsGaleriaFotos/$maxRows_RsGaleriaFotos)-1; $queryString_RsGaleriaFotos = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_RsGaleriaFotos") == false && stristr($param, "totalRows_RsGaleriaFotos") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_RsGaleriaFotos = "&" . htmlentities(implode("&", $newParams)); } } $queryString_RsGaleriaFotos = sprintf("&totalRows_RsGaleriaFotos=%d%s", $totalRows_RsGaleriaFotos, $queryString_RsGaleriaFotos); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #999933; } --> </style></head> <body> <table width="687" border="0" align="center"> <tr> <td bgcolor="#DC4E40"><img src="imagens/cabecalho.jpg" width="700" height="210" /></td> </tr> <tr> <td bgcolor="#DC4E40"><table width="100%" border="0"> <tr bgcolor="#D94837"> <th scope="col"><form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="689" border="0" align="left"> <tr style="text-align: left"> <td width="180" style="color: #993; text-align: right;">Titulo da foto:</td> <td width="499" style="text-align: left"><label> <input name="descImagem" type="text" id="descImagem" size="40" maxlength="50" /> </label></td> </tr> <tr> <td style="color: #993; text-align: right;">Foto:</td> <td style="text-align: left"><label> <input name="miniImagem" type="file" id="miniImagem" size="40" maxlength="50" /> </label></td> </tr> <tr> <td style="color: #000"> </td> <td style="text-align: left"><input type="submit" name="button" id="button" value="Cadastrar" /></td> </tr> </table> </form></th> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0"> <tr> <th bgcolor="#D94837" style="color: #993; font-weight: bold; font-size: large;" scope="col">Fotos Cadastradas</th> </tr> <tr> <th bgcolor="#999933" style="color: #993" scope="col"><?php do { ?> <table width="133" align="right"> <tr> <td width="125" align="center"><img src="<?php echo $row_RsGaleriaFotos['miniImagem];?>" width="129" height="118" /></td> </tr> <tr> <td style="color: #000"><?php $id = $row_RsGaleriaFotos['idImagem']?> <?php echo "<div align=\"center\"><a href=\"exclui_imagem.php?id=$id\">Excluir</a></div></td>";?></td> </tr> </table> <?php } while ($row_RsGaleriaFotos = mysql_fetch_assoc($RsGaleriaFotos)); ?></th> </tr> </table></td> </tr> <tr style=text-align: center; font-weight: bold; color: #D33E37;"> <td height="70"><p style="text-align: right">Imagem...::<?php echo ($startRow_RsGaleriaFotos + 1) ?> de <?php echo min($startRow_RsGaleriaFotos + $maxRows_RsGaleriaFotos, $totalRows_RsGaleriaFotos) ?> <p><a href="<?php printf("%s?pageNum_RsGaleriaFotos=%d%s", $currentPage, 0, $queryString_RsGaleriaFotos); ?>"><img src="imagens/inicio.jpg" width="100" height="30" border="0" /></a><a href="<?php printf("%s?pageNum_RsGaleriaFotos=%d%s", $currentPage, min($totalPages_RsGaleriaFotos, $pageNum_RsGaleriaFotos + 1), $queryString_RsGaleriaFotos); ?>"></a><a href="<?php printf("%s?pageNum_RsGaleriaFotos=%d%s", $currentPage, min($totalPages_RsGaleriaFotos, $pageNum_RsGaleriaFotos + 1), $queryString_RsGaleriaFotos); ?>"><img src="imagens/proximo.jpg" width="100" height="30" border="0" /></a><a href="<?php printf("%s?pageNum_RsGaleriaFotos=%d%s", $currentPage, max(0, $pageNum_RsGaleriaFotos - 1), $queryString_RsGaleriaFotos); ?>"><img src="imagens/voltar.jpg" width="100" height="30" border="0" /><img src="imagens/ultima.jpg" width="100" height="30" border="0" /></a></td> </tr> </table> <a href="<?php echo $logoutAction ?>">Log out</a> </body> </html> <?php mysql_free_result($RsGaleriaFotos); ?> E esse é meu upload.php <?php require_once('Connections/vania.php'); $descricao = $_POST['descImagem]; $preço = $_POST['precoImagem']; $cifra = "R$ ".$preço; $nomeFotoP = $_FILES['miniImagem']['name']; $tmpFotoP = $_FILES['miniImagem']['tmp_name']; $destinoP = "fotosP/".$nomeFotoP; if(move_uploaded_file($tmpFotoP, $destinoP)){ $sql = "INSERT INTO tbimagens (descImagem, precoImagem, miniImagem) VALUES('$descricao','$cifra','$destinoP')"; if($query = @mysql_query($sql)or die("Erro na inserção no banco de dados".mysql_error())){ header("Location: index.php"); header("Location: cadastro_imagem.php"); }else{ echo " Ocorreu erro no cadastro de imagem!"; } }else{ echo "erro ao fazer upload da miniatura"; } ?>