view2.php is an extension or displaying the rest of my code in another file from the other file im targeting the certain id then update it from view2.php into update_info.php but ill get this error
Notice: Undefined variable: id in . . . .
but in my database it was updated just didnt display into my webpage to shorten it
from view2.php into update_info.php back to view2.php after update but ill get this error
Notice: Undefined variable: id in . . . .
view2.php
<?php
include 'dbconfig.php';
$id = $_GET['id'];
$sql = "SELECT * FROM info WHERE id = '$id'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
update_info.php
$sql = "SELECT id FROM info";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
"SOME CODES HERE"
Header("Location: view2.php?=".$row['id']);
You haven't set id parameter in your redirection part:
Header("Location: view2.php?id=".$row['id']);
instead of:
Header("Location: view2.php?=".$row['id']);
mysql_fetch_array returns an array so your id is probably undefined because row is an array. You should try row[0]['id'] if you want the first element and probably do some check to see if the result is not an empty variable from the db. Try var_dump(row) to see what you get from the database. Also you should use require_once for your dbconfig instead of include.