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'> <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'> <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", "");
Why can´t l Update this
Moderator: General Moderators
-
christalix
- Forum Newbie
- Posts: 6
- Joined: Tue Oct 13, 2009 3:50 pm
Why can´t l Update this
Last edited by christalix on Mon Oct 19, 2009 3:32 pm, edited 1 time in total.
Re: Why can´t l Update this
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.