I don’t know why but the code below is working when I have a different query:
$result = mysql_query("SELECT * FROM student WHERE IDNO='".$_GET['id']."'")
?>
<?php while ( $row = mysql_fetch_array($result) ) {
?>
<?php list($year,$month,$day)=explode("-", $row['BIRTHDAY']); ?>
<tr>
<td width="30" height="35"><font size="2">Month:</td>
<td width="30"><input name="mm" type="text" id="mm" onkeypress="return handleEnter(this, event)" value="<?php echo $month;?>">
<td width="30" height="35"><font size="2">Day:</td>
<td width="30"><input name="dd" type="text" id="dd" maxlength="25" onkeypress="return handleEnter(this, event)" value="<?php echo $day;?>">
<td width="30" height="35"><font size="2">Year:</td>
<td width="30"><input name="yyyy" type="text" id="yyyy" maxlength="25" onkeypress="return handleEnter(this, event)" value="<?php echo $year;?>">
And it works when this is my query:
$idnum = mysql_real_escape_string($_POST['idnum']);
mysql_select_db("school", $con);
$result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'");
Please help, why do I get the undefined offset error when I use this query:
$result = mysql_query("SELECT * FROM student WHERE IDNO='".$_GET['id']."'")
I assume that the query is the problem because its the only thing that’s different between the two.
You are missing a semi-colon
;there:Also make sure that you are getting the id:
And it is named really
idor something else.You might go like:
.
Update Based On Comment
Make sure that the date is coming up fine, try this:
and see if everything is coming up or it is empty.