Notice: Undefined index: student_name in C:\xampp\htdo

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

judithawiti
New php-forum User
New php-forum User
Posts: 1
Joined: Fri Mar 21, 2014 3:52 am

Notice: Undefined index: student_name in C:\xampp\htdo

Postby judithawiti » Fri Mar 21, 2014 3:57 am

Hi
I have a query function in another file which I included on my form.
function query(/* $sql [, ... ] */)
{
// SQL statement
$sql = func_get_arg(0);

// parameters, if any
$parameters = array_slice(func_get_args(), 1);

// try to connect to database
static $handle;
if (!isset($handle))
{
try
{
// connect to database
$handle = new PDO("mysql:dbname=" . DATABASE . ";host=" . SERVER, USERNAME, PASSWORD);

// ensure that PDO::prepare returns false when passed invalid SQL
$handle->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch (Exception $e)
{
// trigger (big, orange) error
trigger_error($e->getMessage(), E_USER_ERROR);
exit;
}
}

// prepare SQL statement
$statement = $handle->prepare($sql);
if ($statement === false)
{
// trigger (big, orange) error
// trigger_error($handle->errorInfo()[2], E_USER_ERROR);

exit;
}

// execute SQL statement
$results = $statement->execute($parameters);

// return result set's rows, if any
if ($results !== false)
{
return $statement->fetchAll(PDO::FETCH_ASSOC);
}
else
{
return false;
}
}


On my header form, I have this


<?php

require("../includes/config.php");
$student = query("SELECT * FROM students WHERE id = ?", $_SESSION["id"]);

if($student === false)
{

redirect("../admin/");
}
else
{



}

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>UENR PORTAL | Fees</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="../css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>

<body class="skin-black">
<!-- header logo: style can be found in header.less -->
<header class="header">
<a href="../index.html" class="logo">
<!-- Add the class icon to your logo image or logo icon to add the margining -->
UENR PORTAL
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>

</nav>

</header>

<div class="wrapper row-offcanvas row-offcanvas-left">
<!-- Left side column. contains the logo and sidebar -->
<aside class="left-side sidebar-offcanvas">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="../img/avatar3.png" class="img-circle" alt="User Image" />
</div>
<div class="pull-left info">



<p>Hello <?php echo $student['student_name'];?></p>



<!--<a href="#"><i class="fa fa-circle text-success"></i> Online</a>-->
</div>
</div>
<!-- search form -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search..."/>
<span class="input-group-btn">
<button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li>
<a href="../index.php">
<i class="fa fa-dashboard"></i> <span>Dashboard</span>
</a>
</li>
<li class="active">
<a href="widgets.php">
<i class="fa fa-th"></i> <span>Course Materials</span>
</a>
</li>
<li>
<a href="http://41.66.205.227:90/">
<i class="fa fa-th"></i> <span>Results Checker</span>
</a>
</li>
<li>
<a href="timetable.php">
<i class="fa fa-th"></i> <span>Time Table</span>
</a>
</li>
<li>
<a href="fees.php">
<i class="fa fa-th"></i> <span>Fees</span>
</a>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>

Return to “phpMyAdmin”

Who is online

Users browsing this forum: No registered users and 1 guest