Why can´t l Update this

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
christalix
Forum Newbie
Posts: 6
Joined: Tue Oct 13, 2009 3:50 pm

Why can´t l Update this

Post 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", "");
Last edited by christalix on Mon Oct 19, 2009 3:32 pm, edited 1 time in total.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Why can´t l Update this

Post 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.
Post Reply