Tengo 2 archivos fotos.php y upload_imagenes.php, el problema que surge es que la imagen se guarda en la carpeta uploadedimagenes, todo bien, pero despues la url y la id de usuario que subió la foto no se inserta en la bd, por lo tanto despues en el codigo me aparece el mensaje de "no has subido ninguna imagen" que está en una de las lineas, pero he subido una imagen, asi que no sé.
Y en el upload_imagenes.php hay 1 warning "mysql_num_rows(): supplied argument is not a valid MySQL result resource in online 11"
que seria esta parte:
Código PHP:
Ver original
Ahora dejo los codigos:
fotos.php:
Código PHP:
Ver original
<?php include ("connect.php"); $usuario=$_SESSION["usuario"]; $id=$_SESSION["id"]; ////////---chking $query="select * from prueba_memb_imagenes where id='$_SESSION[id]'"; //die($sbq_off_chk); $sbq_off_img="select * from prueba_memb_imagenes where dm_uid='$id' "; //die($sbq_off_img); $uid=$id; { echo "<font class='red'>".$_REQUEST["msg"]."</font><br>"; } { $cnt=0; $row=0; while($rst) { $cnt++; if($cnt%3==1) { $row++; } if(!($rst)) { $blankpad=(($row*3)-$cnt)%3; while($blankpad>0) { $blankpad--;} } if($cnt%3==0) { } } } else echo "<font size='2' color='#FF0000' face='Verdana, Arial, Helvetica, sans-serif'>No has añadido ninguna imagen</font>"; ?>
el upload_imagenes.php:
Código PHP:
Ver original
<?php include("connect.php"); $uid=$_SESSION["id"]; $sbq_off_img="select * from prueba_memb_imagenes where dm_uid=$uid"; $uid=$id; { $realname = $_FILES['userfile']['name']; ///////--------chking extension ///////--------end chking extension if ($_FILES['userfile']['size']>($config["dm_image_size"])) { $mess="Uploaded files must be less than ".($config["dm_image_size"]/1000)."k, please try again"; } elseif($_FILES['userfile']['size']<=0) { $mess="File could not be uploaded, please try again"; } else { // echo $realname . ", size: ". $_FILES['userfile']['size'] . " [ "; $insert="no"; switch($_FILES['userfile']['error']) { case 0: $mess = "Image has been uploaded successfully"; $insert="yes"; break; case 1: case 2: $mess = "Error : File size more than maximum size allowed by server";break; case 3: $mess = "Error : File partially uploaded"; break; case 4: $mess = "Error : No file uploaded"; break; } // echo $mess . " ] "; // check whether the file exists beforehand, if yes use randomvar in front of filename $newfilename = "uploadedimages/" . $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname); //echo $newfilename; { $newfilename = "uploadedimagenes/" . $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname); } ////////////////////// //=============================if insertion = yes if($insert=="yes") { else if($config["dm_image_magik"]=="enable") { $size_str=$config["dm_th_width"] . "x" . $config["dm_th_width"]; $size_str2=$config["dm_th_width2"] . "x" . $config["dm_th_width2"]; $path1="uploadedimagenes" . '/' . $shortfname; $path2="thumbs1" . '/' . $shortfname; $path3="thumbs2" . '/' . $shortfname; } } }// Else fr more than 60k } else { $mess="Some error occurred, please try again"; } ?>
Gracias de antemano, den_22