Jump to content

Session_id


Nafisah

Recommended Posts

Notice: Undefined index: id in C:\xampp\htdocs\Guttz\Edit.php on line 2

 

 

<?php
        $id = $_GET['id'];
        $host = "localhost";
        $user = "root";
        $pass = "";
        $db = "guttz";
        $link = mysqli_connect($host, $user, $pass, $db);
        
        $query ="SELECT * FROM designers WHERE id ='$id'";
        $result = mysqli_query($link, $query);
        $row = mysqli_fetch_array($result) or die (mysqli_error($link));
        
        mysqli_close($link);
        ?>
        

The get and the post has been the problem . How can I store and save id in session. What is the codes for it ? 

Link to comment
Share on other sites

It seems you dont send the GET var ID when you load the page. Try loading the page with ?id=1 at the end.

 

If you want to save the id in a session, you need to open the session at each page before you do anything else by adding session_start(); at the top of the page;

 

After that you can just get and set session vars like regulair vars. ( $_SESSION['id'] = $id; and $id = $_SESSION['id']; )

 

Good Luck

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.