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
https://forums.phpfreaks.com/topic/278024-session_id/
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
https://forums.phpfreaks.com/topic/278024-session_id/#findComment-1430187
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.