delphi
Class.php <?php session_start(); class Conectar { public static function con() { $con = mysql_connect("localhost","root","123456"); mysql_select_db("terrible_de_pixelado"); return $con; } } class Trabajo { private $videos = array(); private $get_videos = array(); private $get_imagenes = array(); private $gi = array(); public function videos() { $sql = "select * from videos limit 5"; $res = mysql_query($sql,Conectar::con()); while($reg = mysql_fetch_assoc($res)) { $this -> videos[] = $reg; } return $this -> videos; } public function get_videos() { $sql = "select * from videos limit 10"; $res = mysql_query($sql,Conectar::con()); while($reg = mysql_fetch_assoc($res)) { $this -> get_videos[] = $reg; } return $this -> get_videos; } public function get_post_por_id() { $sql = "select * from videos where id =".$_GET["id"]; $res = mysql_query($sql,Conectar::con()); while ( $reg = mysql_fetch_assoc ($res) ) { $this -> post[] = $reg; } return $this -> post; } public function get_img() { $sql = "select * from imagen where id=".$_GET["id"]; $res = mysql_query($sql,Conectar::con()); echo $sql; while ( $reg = mysql_fetch_assoc ($res) ) { $this -> gi[] = $reg; } return $this -> gi; } public function subir_imagenes() { $nombre=$_POST['nombre']; $nombrefoto=$_FILES['foto']['name']; $ruta=$_FILES['foto']['tmp_name']; $destino = "fotos/".$nombrefoto; copy($ruta,$destino); $sql = "insert into imagen(nombre,foto) values('$nombre','$destino')"; $res = mysql_query($sql,Conectar::con()); echo "<script type='text/javascript'> alert('Sus datos se han subido exitosamente'); window.location='subir_imagen.php'; </script>"; } } ?>
delphi
index.php <?php require_once("class/class.php"); $tra = new Trabajo(); $foto = $tra -> get_imagenes(); for($i=0;$i<sizeof($foto);$i++) { ?> <div id="post"> <div id="titulo_2"> <?php echo $foto[$i]["nombre"]; ?> </div> <br /> <div id="im"> <?php echo '<img src="'.$foto[$i]['foto'].'" width="400" heigth="400"/>'?><br /> <br /> <?php $texto = str_replace(" ","-",$foto[$i]["nombre"] ); ?> <a href="<?php echo $texto."-"."f".$foto[$i]["id"].".html" ?>" id="comentar">Comentar</a> <br /> <br /> <hr /> <br /> </div> </div> <?php } ?>
delphi
fotos.php <?php require_once("class/class.php"); $tra = new Trabajo(); $foto = $tra -> get_img(); echo $foto[0]["nombre"]; ?> (Aqui me da este error .. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\pt\class\class.php on line 61)
delphi
.htaccess RewriteEngine On RewriteRule ^.*p([0-9]+)\.html$ noticias.php?id=$1 [L] RewriteRule ^.*f([0-9]+)\.html$ fotos.php?id=$2 [L]
quien me pueda ayudar que me mande un mensaje porfavor! :C