Foros del Web » Programando para Internet » PHP »

No me funciona la base!!!

Estas en el tema de No me funciona la base!!! en el foro de PHP en Foros del Web. Hola, acá estoy pidiendo socorro. Hice un sitio para una inmobiliaria para que carguen las propiedades ellos y pasa que no me graba los datos, ...
  #1 (permalink)  
Antiguo 21/01/2011, 13:51
 
Fecha de Ingreso: enero-2011
Ubicación: Ing. Maschwitz
Mensajes: 8
Antigüedad: 13 años, 3 meses
Puntos: 0
Pregunta No me funciona la base!!!

Hola, acá estoy pidiendo socorro. Hice un sitio para una inmobiliaria para que carguen las propiedades ellos y pasa que no me graba los datos, ni los borra, ni los modifica. Dejo acá el link de una de las páginas que no fucionan para ver si alguien encuentra el error, que supongo será lo mismo en todas las páginas. Aclaro qe mis conocimientos sobre este lenguaje son casi nulos. Gracias!

www.pallottapropiedades.com.ar/galeria/admin/add_category.php
  #2 (permalink)  
Antiguo 21/01/2011, 13:54
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 9 meses
Puntos: 1532
Respuesta: No me funciona la base!!!

1-) el link que posteas no sirve (error HTTP 404: el documento no existe)

2-) sin código, o al menos que postees los mensajes de error es imposible ayudarte
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...
  #3 (permalink)  
Antiguo 21/01/2011, 14:01
 
Fecha de Ingreso: enero-2011
Ubicación: Ing. Maschwitz
Mensajes: 8
Antigüedad: 13 años, 3 meses
Puntos: 0
Pregunta Respuesta: No me funciona la base!!!

Acá va otra vez pero en verdad tendría que subir el código que es muy largo:
A ver si le sacándole la parte del form se entiende =

session_start();

// if session is not registered go to login
if (!session_is_registered("admin"))
{
header("Location: login.php");
}

// if seiion is registered
if(session_is_registered("admin")){
include ("config.php");
include( "settings.inc.php");
include_once ("header.inc.php");
echo "<h2>$la_add_cat_title</h2>";

// if submit has not been clicked
if (!$submit){
echo "<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"add_category.php\" METHOD=\"POST\">
ACA VA TODO LO DEL FORMULARIO
print "<select name=\"cat_father_id\"><option value=\"0\">$la_top_lev</option>";
$select = mysql_query("select * from ".$prefix."store_category");
while ($row = mysql_fetch_array($select))
{
$cat_id_dd = $row["cat_id"];

echo"<option value=\"$cat_id_dd\">";
$cat_full_name = $row["cat_full_name"];
$category = $row["category"];
$catfatherid_1 = $row["cat_father_id"];

$t1 = $category;

if ($catfatherid_1 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_2 = $row1["cat_father_id"];
$catname_2 = $row1["category"];
$t2 = $catname_2;
$catid2 = $catid_2;
}

if ($catfatherid_2 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_3 = $row1["cat_father_id"];
$catname_3 = $row1["category"];
$t3 = $catname_3;
$catid3 = $catid_3;
}

if ($catfatherid_3 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_4 = $row1["cat_father_id"];
$catname_4 = $row1["category"];
$t4 = $catname_4;
$catid4 = $catid_4;
}

if ($catfatherid_4 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_5 = $row1["cat_father_id"];
$catname_5 = $row1["category"];
$t5 = $catname_5;
$catid5 = $catid_5;
}

if ($catfatherid_5 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_6 = $row1["cat_father_id"];
$catname_6 = $row1["category"];
$t6 = $catname_6;
$catid6 = $catid_6;
}

if ($catfatherid_6 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_7 = $row1["cat_father_id"];
$catname_7 = $row1["category"];
$t7 = $catname_7;
$catid7 = $catid_7;
}

if ($catfatherid_7 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_8 = $row1["cat_father_id"];
$catname_8 = $row1["category"];
$t8 = $catname_8;
$catid8 = $catid_8;
}

if ($catfatherid_8 <> 0)
{
$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8";
$result1 = mysql_query ($sql_lowercat);
$row1 = mysql_fetch_array($result1);
$catfatherid_9 = $row1["cat_father_id"];
$catname_9 = $row1["category"];
$t9 = $catname_9;

}


if ($t9)
print "$t9/";
if ($t8)
print "$t8/";
if ($t7)
print "$t7/";
if ($t6)
print "$t6/";
if ($t5)
print "$t5/";
if ($t4)
print "$t4/";
if ($t3)
print "$t3/";
if ($t2)
print "$t2/";
if ($t1)
print "$t1/";

unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfath erid_1,$catfatherid_2,$catfatherid_3,$catfatherid_ 4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$ca tfatherid_8,$catfatherid_9,$catname_1,$catname_2,$ catname_3,$catname_4,$catname_5,$catname_6,$catnam e_7,$catname_8,$catname_9);
echo"</option>";}
echo"</select></td>
</tr>
<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\"><b>$la_upload_im</b></td>
<td width=\"400\" valign=\"top\"><input name=\"upload_image\" type=\"checkbox\" value=\"yes\">$la_upload_checked</td>
</tr>
<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\"><b>$la_image</b></td>
<td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\" TYPE=\"file\">$la_cat_types</td>
</tr>
</tr>
<!--<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\"><b>$la_per_ship</b></td>
<td width=\"400\" valign=\"top\">
$currency<INPUT class=\"textbox\" TYPE=\"text\" NAME=\"per_ship\"></td>
</tr>
</tr>
<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\"><b>$la_per_item</b></td>
<td width=\"400\" valign=\"top\">
$currency<INPUT class=\"textbox\" TYPE=\"text\" NAME=\"item_ship\"></td>
</tr>
</tr>
<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\"><b>$la_per_int_item</b></td>
<td width=\"400\" valign=\"top\">
$currency<INPUT class=\"textbox\" TYPE=\"text\" NAME=\"per_int_ship\"></td>
</tr>
</tr>
<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\"><b>$la_per_int_item2</b></td>
<td width=\"400\" valign=\"top\">
$currency<INPUT class=\"textbox\" TYPE=\"text\" NAME=\"item_int_ship\"></td>
</tr>-->
<tr bgcolor=\"$colour_3\">
<td width=\"200\" valign=\"top\">&nbsp;</td>
<td width=\"400\" valign=\"top\">
<INPUT class=\"submit\" TYPE=\"submit\" NAME=\"submit\" VALUE=\"$la_add_category\"></td>
</tr>
</table>
</td></tr></table>
</FORM>";
}

// if submit has been clicked
if ($submit){
$userfile_size=$_FILES['userfile']['size'] ;
$userfile_type=$_FILES['userfile']['type'] ;
$userfile_name=$_FILES['userfile']['name'] ;
// $userfile=$_FILES['userfile']['tmp_name'];
$userfile = $HTTP_POST_FILES['userfile']['tmp_name'];

// link back
$goback="<a href=\"javascript:history.back()\">$la_try_again</a>";

// if category was not chosen
if (empty($cat_name))
{
echo "<p align=\"center\">$la_cat_name_empt</p><p>$goback</p>";
exit;
}

// if image was not chosen to be uploaded
if($upload_image!=="yes"){

$userfile_name = "catnophoto.gif";
$userfile_name = addslashes($userfile_name);

$sql_insert = "insert into ".$prefix."store_category (category, category_en, cat_image, price, cat_father_id, per_ship, item_ship, per_int_ship, item_int_ship, description) values ('$cat_name','$cat_name_en','$userfile_name', '$price', '$cat_father_id', '$per_ship', '$item_ship', '$per_int_ship', '$item_int_ship', '$description')";

$result = mysql_query($sql_insert);

// result text
echo "<div align='center'>$la_new_cat $category $la_created!<p><p><img src='../images/$userfile_name'><p><a href=\"add_product.php\">$la_add_prod</a> | <a href=\"add_category.php\">$la_add_cat_title</a></p><p><a href=\"categories.php\">$la_back_cat_admin</a></p></div>";
}

// if upload image was clicked
if($upload_image=="yes"){
// Upload
$path = "$site_dir/images/";
$max_size = 200000;

if (is_uploaded_file($userfile)) {

if ($userfile_size>$max_size) { echo "$la_too_big<br>\n"; exit; }

if (($userfile_type=="image/gif") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/x-png") || ($userfile_type=="image/png") || ($userfile_type=="image/jpeg")) {

if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; }

if($escape!=1){
$res = move_uploaded_file($userfile, $path . $userfile_name);}
if($escape=1){$res="continue";}

// Resultant output
if (!$res) {
echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }
} else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }


$sql_insert = "insert into ".$prefix."store_category (category, category_en, cat_father_id, price, cat_image, per_ship, item_ship, per_int_ship, item_int_ship, description) values ('$cat_name','$cat_name_en', '$cat_father_id', '$price', '$userfile_name', '$per_ship', '$item_ship', '$per_int_ship', '$item_int_ship', '$description')";

$result = mysql_query($sql_insert);

echo "<div align='center'>$la_new_cat $category $la_created!<p><p><img src='../images/$userfile_name'><p><a href=\"add_product.php\">$la_add_prod</a> | <a href=\"add_category.php\">$la_add_cat_title</a></p><p><a href=\"categories.php\">$la_back_cat_admn</a></p></div>";}
}}
include ("footer.inc.php");
} // end if session is registered

GRACIAS
  #4 (permalink)  
Antiguo 21/01/2011, 14:54
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 9 meses
Puntos: 1532
Respuesta: No me funciona la base!!!

¿no te sale ningún error?

trata de añadir error_reporting(E_ALL); para obligar a que salgan los errores

NOTA: funciones como session_is_registered están obsoletas
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...
  #5 (permalink)  
Antiguo 21/01/2011, 20:22
 
Fecha de Ingreso: enero-2011
Ubicación: Ing. Maschwitz
Mensajes: 8
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: No me funciona la base!!!

Ahora Sí: me dijo esto:

Notice: Undefined variable: submit in /home/pallotta/public_html/galeria/admin/add_category.php on line 45

Este sitio lo hice hace un par de años y se perdió el backup de la base. Lo tuve que volver a instalar.
Gracias por tu tiempo!

Etiquetas: php-mysql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:28.