ronnie88 Posted July 23, 2008 Share Posted July 23, 2008 Iam trying to update va column but I keep getting errors the form looks like this: <form action="insert.php" method="post"> <br><tr><td>Your VirtualAirline:</td><td><input type="text" name="va" maxlength="25"></td> <td><input name="add" type="submit" id="add" value="New VA"></td> <form></tr> and the insert.php looks like this: <? include("database.php"); mysql_select_db('users') or die('Error, cannot select mysql database'); $query = "UPDATE user SET va = va('va') WHERE user = '$_SESSION[username]'"; mysql_query($query) or die('Error, query failed'); ?> thanks in advance Link to comment https://forums.phpfreaks.com/topic/116123-solved-how-to-update-a-column/ Share on other sites More sharing options...
cooldude832 Posted July 23, 2008 Share Posted July 23, 2008 what troubles me is the va = va('va') part I don't see any variable or anything in there and that query should be failing Link to comment https://forums.phpfreaks.com/topic/116123-solved-how-to-update-a-column/#findComment-597147 Share on other sites More sharing options...
abdfahim Posted July 23, 2008 Share Posted July 23, 2008 Can you explain what actually you intended to do when you write SET va = va('va') in you mysql query? Link to comment https://forums.phpfreaks.com/topic/116123-solved-how-to-update-a-column/#findComment-597148 Share on other sites More sharing options...
ronnie88 Posted July 23, 2008 Author Share Posted July 23, 2008 lol idk im new I was just copying the format of this.. http://www.php-mysql-tutorial.com/mysql-update-and-delete.php the script was meant to update va column of the username currently logged on from the above form of the textfield I'm still stuck. Link to comment https://forums.phpfreaks.com/topic/116123-solved-how-to-update-a-column/#findComment-597149 Share on other sites More sharing options...
ronnie88 Posted July 23, 2008 Author Share Posted July 23, 2008 I also tried this.... <? include("database.php"); $ud_id = $_POST['va']; $ud_id = stripslashes($ud_id); # everything checks out so far, so lets update the story! $_POST = array_map('mysql_real_escape_string',$_POST); $sql = mysql_query ("UPDATE users SET va='$ud_title' WHERE username='$_SESSION[username]'") or die(mysql_error()); mysql_close(); echo 'News Story Updated Successfully. Return to Admin Area. <a href="newsadmin.php">here</a>'; ?> but still no luck. Link to comment https://forums.phpfreaks.com/topic/116123-solved-how-to-update-a-column/#findComment-597160 Share on other sites More sharing options...
tibberous Posted July 23, 2008 Share Posted July 23, 2008 Go download Navicat. Change mysql_query to die, grab the text verbatim as it would be sent to mysql, run it straight and see what the error is. Navicat will save you a ton of time down the road Link to comment https://forums.phpfreaks.com/topic/116123-solved-how-to-update-a-column/#findComment-597166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.