Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/10/2009, 09:25
totolia
 
Fecha de Ingreso: mayo-2008
Mensajes: 315
Antigüedad: 18 años, 5 meses
Puntos: 7
Ayuda php con mysql

Pues estoy haciendo una modificación para un ccms mio y no me acaba de salir.
Verán es un codigo para editar el titulo y commentario si eres el creador del post o solo el comentario si respondes a el.


Toda la linea funciona, el name del input text donde va el titulo es nombre. El problema es que query1 no envia los datos a la mysql.

Código PHP:
<?php


define
('_VALID_INCLUDE', TRUE);
$ajax_page = 1;
$ispopup = "1";
$in_pm_popup = "1";
$out_of_index = "1";
include 
"../core.php";
defined('_VALID_CRINC') or die();
include 
"../FCKEditor/fckeditor.php";

// IE button fix
$submit_button_fixed = str_replace("src=\"","src=\"$siteurl/", $submit_button);

echo 
"<title>$sitename - $lang_edit_post</title>\n";

echo 
"$body\n";
echo 
"$header

</head>
<div class=\"frontendpopup\">\n"
;

//===================================================
//     POST DETAILS
//===================================================
$post_info = mysql_query("SELECT * from " .$config_ccms_prefix. "forums_post where id='$_REQUEST[id]'");
while (
$ccms = mysql_fetch_assoc($post_info)) {

    
$id = $ccms[id];
    
$title = $ccms[title];
    
$tid = $ccms[tid];
    
$fid = $ccms[fid];

echo 
"    <fieldset>
    <legend><span class=\"legend\"><strong>$lang_edit_post</strong></span></legend>\n"
;

    if (!
$_POST[umessage]) {
    } else {

//===================================================
//     UPDATE THE POST
//===================================================

        

        
$umessage_fixed = mysql_real_escape_string($_POST[umessage]);
        
$rdate = date("Y-m-d H:i:s");
        
$notes = "$lang_last_edited_by $username $lang_on $rdate";

        
$replacements = array("{username}" => "$username", "{date}" => "$rdate");
        
$notes = str_replace(array_keys($replacements),array_values($replacements),$lang_editmessage);

        
$query = "UPDATE " .$config_ccms_prefix. "forums_post SET umessage='$umessage_fixed', notes='$notes' WHERE id='$_REQUEST[id]'";
        if (@
mysql_query($query)) {
echo 
"        <span class=\"okay\">$lang_post_edited</span>\n";
        } else {
            if (
$debug_mode == "1") {
echo 
"                <blockquote><span class=\"warning\">" . mysql_error() . "</span>\n";
            }
        }


$lola = $_REQUEST[id2];
$nombre = mysql_real_escape_string($_POST[nombre]);
$query1 = "UPDATE " .$config_ccms_prefix. "forums_thread SET title='$nombre' where id='$lola'"; 
        if (@
mysql_query($query1)) {
echo 
"        <span class=\"okay\">Cambio de titulo almanecado. Pulse enviar para acavar la edicion de su post.</span>\n";
        } else {
            if (
$debug_mode == "1") {
echo 
"                <blockquote><span class=\"warning\">" . mysql_error() . "</span>\n";
}
}

    }

    if (!
$_POST[umessage]) {

//===================================================
//     ERROR
//===================================================

        
if (!$username) {
            echo 
"<span class=\"warning\">$lang_level_insuff</span>";
        } else {

//===================================================
//     FORM
//===================================================

$postbits = mysql_query("SELECT * FROM " .$config_ccms_prefix. "forums_post where id='$_REQUEST[id]'");
            while (
$ccms = mysql_fetch_assoc($postbits)) {

                
$eun = $ccms[username];
$postbits1 = mysql_query("SELECT * FROM " .$config_ccms_prefix. "forums_thread where id='$_REQUEST[id2]'");
            while (
$ccms1 = mysql_fetch_assoc($postbits1)) {
if (
$ccms1[starter] == "$username") {



                echo 
" <p><input type=\"text\" name=\"nombre\" id=\"nombre\" size=\"25\" value=\"$ccms1[title]\" /></p>";


echo 
" &nbsp;\n";




}
}
                if (
$eun == "$username") {

echo 
"    <form action=\"$siteurl/forums/edit.php?id=$_REQUEST[id]&edit=do\" method=\"post\">

    <p></p>
    <p>\n"
;
        
$oFCKeditor = new FCKeditor('umessage') ;
        
$oFCKeditor->BasePath = '../FCKEditor/';
        
$oFCKeditor->Value = "$ccms[umessage]";
        
$oFCKeditor->Create() ;
echo 
"    </p>
    $submit_button_fixed
    </form>
    </fieldset>\n"
;
                }
            }

//===================================================

        
}
    }
}


?>
</div>

Haber si encontrais algun error en la linea query1 o name=\"nombre\" porque yo no lo veo.


Os pongo todo el codigo porque nose que os devo poner igual me podria dejar algo importante