hello, my name is paolo and im having trouble with some php mysql scripting...
im creating a website for a community and it should be editable by any webmaster or by anyone with no web developing training at all.
so i created several sections and each can be editable by admins (register/login system knows who is an admin and who is not).
so at the modifying part of each section I created a form like this:
<form method='POST' action='$rootAdress/index.php?sec=his&mod=1&c=1&sql=1'>
<textarea rows='30' name='textoNuevo' cols='65'>$contenido</textarea>
<input type='submit' value='Enviar' class='submit'>
</form>
$contenido is the variable to edit for later be included at the sql table 'categorias'
$rootAdress is the adress of the domain. (if you are wondering what are the whole sec=his, mod=1,.. things... they are just variables at index.php that indicates which file to include...)
at the $rootAdress/index.php?sec=his&mod=1&c=1&sql=1 file i wrote this:
$textoNuevo = $_POST['textoNuevo'];
$query = "UPDATE categorias SET contenido='$textoNuevo' WHERE seccion = 'his'";
$doQuery = mysql_query($query)or die ('no se actualizó');
and this does not updates the 'contenido' value from table 'categorias'....
i did some tests and if i add this
$textoNuevo = $_POST['textoNuevo'];
echo($textoNuevo);
$query = "UPDATE categorias SET contenido='$textoNuevo' WHERE seccion = 'his'";
$doQuery = mysql_query($query)or die ('no se actualizó');
it shows the info wrote by the user at the initial textarea.... but it just wont update the database...
so i thought the query was not "well-wrote" so i tried this
$textoNuevo = $_POST['textoNuevo'];
$textoNuevo = 'hello world';
$query = "UPDATE categorias SET contenido='$textoNuevo' WHERE seccion = 'his'";
$doQuery = mysql_query($query)or die ('no se actualizó');
and this worked... the contenido value from table categorias stored the value hello world!
i just dont know what is going on.. i dont know if when the data "travels" trough POST method it changes or something... even though i tried to identify the type of variable the form posted... and it is string... and the contenido value from table categorias is a varchar with 99 length...
im pretty sure is something stupid and im just retard or something.. but i just didnt find out what is wrong.. please if any1 knows how to solve this answer me... oh, and sorry for my terrible english!!
hallo from colombia!
Paolo.


LinkBack URL
About LinkBacks
Reply With Quote




