PHP - error php conexion con SQL

   
Vista:

error php conexion con SQL

Publicado por miguel (4 intervenciones) el 03/04/2014 18:39:04
Buenas e aqui mi error el cual deberiar mostrarme una galeria de imagenes

Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Applications/XAMPP/xamppfiles/htdocs/CineExpress/getGalery.php on line 16

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known' in /Applications/XAMPP/xamppfiles/htdocs/CineExpress/getGalery.php:16 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/CineExpress/getGalery.php(16): PDO->__construct('mysql:host=loca...', 'root', '', Array) #1 /Applications/XAMPP/xamppfiles/htdocs/CineExpress/getGalery.php(20): Database1->__construct() #2 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/CineExpress/getGalery.php on line 16

codigo donde hago la galeria

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
define('DB_HOST', 'locahost');
  define('DB_USER', 'root');
  define('DB_PASS', '');
  define('DB_NAME', 'orion_core_cine_express_2');
  define('DB_CHAR', 'utf8');
 
 
class Database1 extends PDO{
 
  function __construct(){
    parent::__construct(
      'mysql:host=' . DB_HOST .
      ';dbname=' . DB_NAME,
      DB_USER, DB_PASS, array(
        PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . DB_CHAR
        )
      );
  }
}
 
	$db=  new Database1();
$parent= !empty($_POST['parendId'])?$_POST['parendId']:0;
	$data = $db->query("SELECT f.family_id, f.family_name, f_img.url_img_grande, f.family_parent_id
								   FROM t_orion_core_family as f, t_orion_core_family_img as f_img
								   WHERE f.family_id = f_img.family_id 
								   AND f.family_parent_id = '".$parent."'
								   AND f.family_status_id = 1
								   ORDER BY f.order ASC");
	$array = $data->fetchAll(PDO::FETCH_ASSOC);
 
if($parent != 0){
   $atras= !empty($_POST['atras'])?$_POST['atras']:'';
     $inicio= !empty($_POST['inicio'])?$_POST['inicio']:'';
}else{
		 $inicio= !empty($_GET['inicio'])?$_GET['inicio']:'';
 
    }
?>
 
 
 
<div id="TituloGaleria" class="clearfix grpelem rgba-background cuadro-1 colelem FondoOscuroMenu">
  <p class="TituloContenidoPpl" style="text-align: center">AMPLIA <span id="n165">GALERIA</span> DE NUESTROS MAS <span id="n167">ELABORADOS</span> PLATOS Y POSTRES</p>
</div>
 
 
<div class="galery fondoscuro2" style="margin-top:50px;" >
<?php if (!empty($atras)) { ?>
<span onclick="EjecutarAjaxGalery('getGalery.php?inicio=<?= $atras ?>','container')" class='atras' >ATRAS </span>
<?php } ?>
  <ul id="carousel" class="elastislide-list" style="">
    <?php
    $cont=0;
 
    foreach ($array as $key) { ?>
 
        <?php if (!empty($atras)) { ?>
        <li id="<?= $key['family_id'].'-'.$atras.'-'.($cont+1) ?>">
          <a onclick="EjecutarAjax1('menu/galery', 1, 'container', '<?= $key['family_id'].'-'.$atras.'-'.($cont+1) ?>')">
        <?php }else{ ?>
        <li id="<?= $key['family_id'].'-NADA-'.($cont+1); ?>">
          <a onclick="EjecutarAjax1('getGaleryProducto.php', 1, 'container', '<?= $key['family_id'].'-NADA-'.($cont+1); ?>')">
        <?php } ?>
          <div class="FondoOscuro50 textcarrousel" style="font-weight:bold;"><?= $key['family_name']; ?></div>
          <img src="<?= 'public/' . $key['url_img_grande']; ?>" alt="<?= $key['url_img_grande']; ?>" width="500" height="90" alt="prueba">
        </a>
      </li>
    <?php $cont++;
		}
     ?>
  </ul>
</div>
<script type="text/javascript" src="libraryJs/jquery-1.8.3.min.js"></script>
 
 
<script src="libraryJs/modernizr.custom.17475.js"></script>
<script type="text/javascript" src="libraryJs/jquerypp.custom.js"></script>
<script type="text/javascript" src="libraryJs/jquery.elastislide.js"></script>
<?php if (!empty($inicio))
{
 echo "<script type='text/javascript'> $('#carousel').elastislide({ orientation : 'vertical', start:".($inicio-1)." }); </script>";
 }else{
 
  echo "<script type='text/javascript'> $('#carousel').elastislide({ orientation : 'vertical' }); </script>";
 }
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder