Jump to content

Increase id by 1 with each link??


loftusp

Recommended Posts

a little shove never helps

 

get a record set of users (or whatever it is) and loop through it.

use the data to create links a bit like this:

 

<?php
echo "<a href='deleteuser.php?id=" . $row['id'] . "'>delete " . $row['username'] . "</a>";
?>

 

 

Sorry I'm really not good at this. Basically my table is called locations into which a user adds their location and activity. This is then linked to a user in a person_location table. This is the delete code I have created. Not sure how good it is.

 

 

case 'delete' :

$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';

if (!$id) {

echo 'No Location identified!';

} else

{

$currentLocation = R::findOne('location', 'id=?', array($id));

$pps = R::findOne('person', 'name=?', array($_SESSION['name']));

// Why is this not deleting it from the database???

R::unassociate($_SESSION['name'], $currentLocation);

R::trash($currentLocation);

}

$tpl = 'loggedin.twig';

break;

 

 

Using that detail what would the . $row['id'] . be??

Link to comment
Share on other sites

Also this is how the data is stored:

 

case 'location' :

    if ($_POST['location'] && $_POST['activity'])

            {

              $pld = R::dispense('locations');

$pld->location = $_REQUEST['location'];

$pld->activity = $_REQUEST['activity'];

$id=R::store($pld);

R::associate($_SESSION['name'], $pld);

$vals['location'] = R::related ($_SESSION['name'], 'locations');

$tpl='loggedin.twig';

    }else

    {

        echo "no user!";

$tpl='loggedin.twig';

    }

    break;

Link to comment
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.