Jump to content

Recommended Posts

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"]; ?>

Link to comment
https://forums.phpfreaks.com/topic/272465-function-or-query-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.