walon Posted December 29, 2012 Share Posted December 29, 2012 I have a problem when i Click the Edit button int he form, the database doesn't update, In the beginning i thought i had a problem with the query, but I did a check as a query and everything was fine. Can someone suggest something please. //this is the file - album.func.php function edit_album($album_id, $album_name, $album_description) { $album_id = ((int)$album_id); $album_name = mysql_real_escape_string($album_name); $album_description = mysql_real_escape_string($album_description); mysql_query("UPDATE `albums` SET `name`='$album_name', `description`='$album_description' WHERE `album_id`='$album_id' AND `user_id`=".$_SESSION["user_id"]); } //this is the file - edit_album.php if (!empty($errors)) { foreach ($errors as $error) echo $error; }else { edit_album($album_id, $album_name, $album_description); header('Location: index.php'); exit(); }} ?> <?php $album_id = $_GET["album_id"]; $album_data = album_data($album_id, 'name', 'description'); ?> //this is the form <form action="?album_id=<?php echo $album_id; ?>" method="post"> <p>Name:</br><input type="text" name="album_name" maxlength="55" value="<?php echo $album_data["name"]; ?>"/></p> <p>Description:</br><textarea name="album_description" rows="6" cols="35" maxlength="500"><?php echo $album_data["description"]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/272465-function-or-query-problem/ Share on other sites More sharing options...
Jessica Posted December 29, 2012 Share Posted December 29, 2012 You're not checking for errors - see my signature for SQL debugging. Quote Link to comment https://forums.phpfreaks.com/topic/272465-function-or-query-problem/#findComment-1401930 Share on other sites More sharing options...
Barand Posted December 29, 2012 Share Posted December 29, 2012 ...and at what point do you connect to the DB server Quote Link to comment https://forums.phpfreaks.com/topic/272465-function-or-query-problem/#findComment-1401939 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.