Page 1 of 1

Why can´t l Update this

Posted: Mon Oct 19, 2009 9:19 am
by christalix
I am trying to update files in my DB...>l have tried with but it only fetches the array from the database , but when l click on save, it does not change any thing. any help please?
___________________________________________________


$query = "SELECT contenttext FROM content WHERE nid=$nid AND labelname='headline'";
$result6=my_sql_query($query, '');
foreach ($result6[1] as $key => $value){
echo "<form name='form1' action='edit.php?now=$now&nid=$nid&element=$element&type=$type' method='post'>\n"
."<div id='divEdit'>\n"
."<table width='100%'>\n"
."<tr>\n"
."<td width='10%'></td>\n"
."<td width='80%'>"._PLAINTITLE."</td>\n"
."<td width='10%'></td>\n"
."</tr>\n"
."<tr>\n"
."<td width='10%'></td>\n"
."<td width='80%'><input name='textfield' type='text' value=". $value['contenttext']." size='50' maxlength='50'>&nbsp;&nbsp; <input type='checkbox' name='linked' value='1' $checked>"._LINKED."</td>\n"
."$contenttext"
."<td width='10%'></td>\n"
."</tr>\n"
."<tr align='center'>\n"
."<td width='10%'></td>\n"
."<td width='80%'><input type='submit' name='save' value='"._SAVE."' id='button'>&nbsp;&nbsp;<input type='submit' name='reset' value='"._RESET."' id='button'></td>\n"
."<td width='10%'></td>\n"
."</tr>\n";
echo "</table>\n"
."</div>\n"
."</form>\n";
_____________________________
NOW Updating
______________________________

$sql = "UPDATE content SET contenttext='$content', link_active='".$_POST['linked']."' WHERE nid='$nid' AND labelname='$element'";
my_sql_query("UPDATE navi SET lastmod='".date("Y-m-d H:i:s")."' WHERE nid=$nid", "");

Re: Why can´t l Update this

Posted: Mon Oct 19, 2009 1:47 pm
by califdon
You need to learn the very basics of using PHP to manage databases. There are so many things wrong with the code you presented that I won't even attempt to correct them individually. Read a tutorial like http://www.w3schools.com/PHP/php_mysql_update.asp.