Jump to content

Archived

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

proctk

change table data

Recommended Posts

below is code that 'm try use create to delete change table data based on the value in a column

if column user_id has a value and column Otheruser_id is balk I want the table row deleted

if the column Otheruser_id has a value and the user that has a value in column user_id wants to remove themself form the profile i want to give the option to change the value in the colum user_id to blank

If the the value in column Otheruser_id is blank and the user wants to remove themself from the profile then I want the table row to be deleted.

hope this makes sense any help is great

thank you

[code=php:0]
<title>Delete Child</title>

<?

include 'db.php';

$user_id = $_REQUEST['id'];

$sql_delete_child = mysql_query("SELECT * FROM children WHERE user_id = '$user_id'
OR Otheruser_id = '$user_id'");

  $delete_child_found = mysql_fetch_array($sql_delete_child) or die(mysql_error());

$chid_id = $delete_child_found['user_id'];
$Otheruser_id = $delete_child_found['Otheruser_id'];

if($child_id == $user_id){
mysql_query("UPDATE children SET user_id = 'null' WHERE user_id='$user_id'");

}

if($user_id == $Otheruser_id){
mysql_query("UPDATE children SET Otheruser_id = 'null' WHERE Otheruser_id='$user_id'");

}

if($child_id == $user_id and $Otheruser_id <= 0){
mysql_query("DELETE FROM children WHERE user_id = '$user_id'") or die(mysql_error());

}

include 'getchildren.php';


?>

[/code]

Share this post


Link to post
Share on other sites
I don't understand what you mean, don't mind explain it alittle more with details ?

Share this post


Link to post
Share on other sites
I want to give users the ability to remove thier user_id from a table.  the columns where their user_id could be found is column "user_id" or "Otheruser_id".  There will be a link next to the information that will update the table.

Share this post


Link to post
Share on other sites
How to add to the start date to get the next date until the end date is reached.
creating the loop with the date

Share this post


Link to post
Share on other sites

×

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.