Forum Moderators: coopster
$Search = $_POST["Search"];
$connect = @mysql_connect($host, $user, $passwd)
or die("connect error: " . mysql_error());
$table_name = 'student';
@mysql_select_db($database)
or die('select_db error: ' . mysql_error());
$query = "SELECT * FROM $table_name WHERE
(stu_id = '$Search')";
print "$query<br>";
$result_id = mysql_query($query, $connect) or die("querry errror: " . mysql_error());
the error says: Undefined Index Search on line 15
then it prints the query.
thanks a million
which is line 15?
is it this line?
$Search = $_POST["Search"];
if so then I would check that the caps match the actual element being posted
another way to debug is to dump the $_POST array to see what's in there, like so
echo '<p>POST:<pre>';
print_r($_POST);
echo '</pre>';
$query = "SELECT * FROM $table_name WHERE
(stu_id = '$Search')";
print "$query<br>";
$result_id = mysql_query($query, $connect) or die("querry errror: " . mysql_error());
}
dc
[edit]jatar_k beat me to it. Oh, well at least you have 2 alternatives. And welcome to WebmasterWorld nabilino
like this:
<?php
// Make a MySQL Connection
$host= "*******";
$user = "******";
$passwd = "******";
$database = "******";
$Search = $_POST["Search"];
$connect = @mysql_connect($host, $user, $passwd)
or die("connect error: " . mysql_error());
$table_name = 'student';
@mysql_select_db($database)
or die('select_db error: ' . mysql_error());
$query = "SELECT * FROM $table_name WHERE
(stu_id = '$Search')";
print "$query<br>";
$results_id = mysql_query($query, $connect) or die("querry errror: " . mysql_error());
if($row = mysql_fetch_array($results_id)){
extract($row);
print("<br /> the insert student ID form<br />");
/* echo "stu_id :{$row['stu_id']} <br>";
echo $row['stu_id'] . " <br>";
foreach ($row as $key => $value) {
print "$key = $value <br>";
}
}*/
?>
</body>
</html>
thanks
<?php
// Make a MySQL Connection
$host= "*******";
$user = "******";
$passwd = "******";
$database = "******";
$Search = $_POST["Search"];
$connect = @mysql_connect($host, $user, $passwd) or die("connect error: " . mysql_error());
$table_name = 'student';
@mysql_select_db($database) or die('select_db error: ' . mysql_error());
$query = "SELECT * FROM $table_name WHERE (stu_id = '$Search')";
print "$query<br>";
$results_id = mysql_query($query, $connect) or die("querry errror: " . mysql_error());
if($row = mysql_fetch_array($results_id)){
extract($row);
print("<br /> the insert student ID form<br />");
/*
echo "stu_id :{$row['stu_id']} <br>";
echo $row['stu_id'] . " <br>";
foreach ($row as $key => $value) {
print "$key = $value <br>";
}
*/
}
?>
</body>
</html>