Jump to content

Undefined index


jeff5656

Recommended Posts

I want to sort columns by clicking the name of each column (see code) but

I get this error:

Notice: Undefined index: column_name in C:\wamp\www\mc\displaybundle.php on line 24

 

$query = "SELECT * FROM icu WHERE signoff_status = 'a' ";

$column_name=$_GET['column_name']; /*<--- this is line 24*/

if(isset($column_name) and strlen($column_name)>0){
$query = $query . " order by $column_name ";
} 
else {
$query = $query . " order by rm_loc ";
}


$results = mysql_query ($query) or die (mysql_error());
$num_pts = mysql_num_rows ($results);

 

and here are the column headings starting down at line 41

 

<th width="5%" align="left"><a href='displaybundle.php?column_name=rm_loc'> Room</a></th>
<th width="5%" align="center"><a href='displaybundle.php?column_name=pod'>Pod</a></th>

 

This error GOES AWAY after I sort a column for the first time!

Link to comment
https://forums.phpfreaks.com/topic/154421-undefined-index/
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.