naveenbj Posted February 12, 2008 Share Posted February 12, 2008 Hello , Thanks for your time !! I stuck in a problem so there is anyone who can help me for this?? database_connect(); $id=$_GET['id']; $sql = "UPDATE content SET title='$titel', keywords='$trefwoorden', text='$Body' WHERE id='$id'"; } Above is my update script which im using but im not getting the output even when i click submit it shows no error . and this is the code which i use for data retrieve. database_connect(); $id=$_GET['id']; $select = "SELECT * FROM content where id = '$id'"; $query = mysql_query($select); $nieuws = mysql_fetch_object($query); $deid = $nieuws->id; $titel = $nieuws->title; $trefwoorden = $nieuws->keywords; $tijd = $nieuws->posting_time; $tekst = $nieuws->text; SO if any one can help will be highly appriciated ------------------ ("i hope the info. which i place here is sufficient for debug if you all hav any other question for this thn please lat me kno. ") Best Regards, Nj Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/ Share on other sites More sharing options...
trq Posted February 12, 2008 Share Posted February 12, 2008 Firstly, your script doesn't output anything, hence, you don't see anything. secondly, you never execute your query, hance it does nothing. Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464873 Share on other sites More sharing options...
naveenbj Posted February 12, 2008 Author Share Posted February 12, 2008 Firstly, your script doesn't output anything, hence, you don't see anything. secondly, you never execute your query, hance it does nothing. Thanks for reply !! Sorry im ot getting what you exactly want to say . so can you brief me out for this:) Regards Nj Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464874 Share on other sites More sharing options...
trq Posted February 12, 2008 Share Posted February 12, 2008 In order for your update statement to do anything you must execute it using mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464885 Share on other sites More sharing options...
naveenbj Posted February 12, 2008 Author Share Posted February 12, 2008 In order for your update statement to do anything you must execute it using mysql_query. Thanks for reply!! ohk so can you please guide me for this like . i mean how to do?? Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464892 Share on other sites More sharing options...
naveenbj Posted February 12, 2008 Author Share Posted February 12, 2008 In order for your update statement to do anything you must execute it using mysql_query. you mean to say smthing like this $sql = mysql_query("UPDATE content SET title='$titel', keywords='$trefwoorden', text='$Body' WHERE id='$id'" Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464895 Share on other sites More sharing options...
trq Posted February 12, 2008 Share Posted February 12, 2008 you mean to say smthing like this Yes. There is an example in your second piece of code. Failing that, click the link to mysql_query that I provided, this will take you to the manual page for that function. Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464896 Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 http://www.freewebmasterhelp.com/tutorials/phpmysql Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464897 Share on other sites More sharing options...
naveenbj Posted February 12, 2008 Author Share Posted February 12, 2008 http://www.freewebmasterhelp.com/tutorials/phpmysql Thanks for your links and suggestions But b4 that i recommond you to see my full code and i think it will clear you more about my code database_connect(); $id=$_GET['id']; $sql = mysql_query("UPDATE content SET title='$titel', keywords='$trefwoorden', text='$Body' WHERE id='$id'"); } $query = mysql_query($sql)or die("There's a problem with the query: ". mysql_error()); i just forgot to place the full code so what should i need to do?? Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464899 Share on other sites More sharing options...
naveenbj Posted February 12, 2008 Author Share Posted February 12, 2008 Or you can have the complete code which im using <?php require "auth.php"; require "./dbfunctions.php"; include("../config.php"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Modify Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="style.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> </head> <body> <span class="titel1">Modify Page</span> <br> <?php if(!isset($_GET['id'])) { echo "wrong parameters"; exit; } /*//---------------------------------- // DELETE PACKSHOT //---------------------------------- if($_GET['mode']=="delete") { $id = $_GET['id']; // foto uit database halen $query = "UPDATE `shop_artikel` SET `foto` = '0' WHERE `id` = '$id' "; mysql_query($query,$link) or die("foto niet verwijderd uit database"); $queryke = "SELECT foto from shop_artikel where id = $id"; $resulteke = mysql_query(queryke); while($rij = mysql_fetch_object($resulteke)){ $foto_naam = "$rij->foto"; } // foto en thumb deleten if (!unlink("$abspackpath/$foto_naam")) exit("error bij deleten van foto {$abspackpath}/{$foto_naam}"); if (!unlink("$abspackpath/thumb_$foto_naam")) exit("error bij deleten van thumb"); } //---------------------------------- // EINDE DELETE PACKSHOT //----------------------------------*/ if ($_POST['submit']) { database_connect(); //--- TESTen $id = $_GET['id']; $titel = $_POST['titel']; $trefwoorden = $_POST['trefwoorden']; $tekst = $_POST['tekst']; //begin image uploaden if($titel=="") $foutbericht .= "Please fill in a title.<br>"; if (!$foto==0) { $fotovar = $foto; }else if (!isset($error_toevoegen)){ $fotovar = $foto_naam; } else { $fotovar = 0; } if($foutbericht) echo "<br>" . $foutbericht . "<br><input name=\"back\" type=\"button\" value=\"< Back\" onClick=\"history.go(-1)\">"; else { database_connect(); $id=$_GET['id']; $sql = "UPDATE content SET title='$titel', keywords='$trefwoorden', text='$Body' WHERE id='$id'"; } $query = mysql_query($sql)or die("There's a problem with the query: ". mysql_error()); if($query) echo "<br>The page is succesfully edit.<br><br>\n<a href=\"item_list.php\" target=\"links\"><img src=\"../img/ico_overview.gif\" width=\"19\" height=\"19\" border=\"0\" alt=\"Pages\"></a> <a href=\"item_detail.php?id=$id\"><img src=\"../img/ico_detail.gif\" width=\"19\" height=\"19\" border=\"0\" alt=\"More info\"></a> <a href=\"item_modify.php?id=$id\"><img src=\"../img/ico_edit.gif\" width=\"19\" height=\"19\" border=\"0\" alt=\"Edit\"></a>"; } else { database_connect(); $id=$_GET['id']; $select = "SELECT * FROM content where id = '$id'"; $query = mysql_query($select); $nieuws = mysql_fetch_object($query); $deid = $nieuws->id; $titel = $nieuws->title; $trefwoorden = $nieuws->keywords; $tijd = $nieuws->posting_time; $tekst = $nieuws->text; ?> <form action="" method="post" enctype="multipart/form-data" id="Compose" name="Compose"> <table border="0"> <tr> <td class="titel3">title</td> <td><input name="titel" type="text" value="<?php echo $titel; ?>" size="10" maxlength="20"></td> </tr> <tr> <td class="titel3" width="75">time of posting</td> <td><input disabled name="tijd" type="text" value="<?php echo timestamp2datime($tijd); ?>" size="25" maxlength="50"></td> </tr> <tr valign="top"> <td width="75" class="titel3">keywords</td> <td><textarea name="trefwoorden" cols="30" rows="3" id="trefwoorden"><?php echo $trefwoorden; ?></textarea></td> </tr> <tr valign="top"> <td width="75" class="titel3">text</td> <td> <?php include("editor/editor.php"); ?></td> </tr> <tr> <td> </td> <td><input name="submit" type="submit" value="submit" onClick="SetVals()"></td> </tr> </table> </form> <?php } ?> </body> </html> -------------- I hope this will help you to understand my problem . sorry im not very good in explaining the things:( ------------- Regards, Nj Quote Link to comment https://forums.phpfreaks.com/topic/90693-problem-in-data-updating/#findComment-464913 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.