Jump to content

Function Or Query Problem


walon

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.