variable not set
Posted: Tue Oct 04, 2005 10:40 pm
Any reason why the following snippet wouldn't work.
Everything is named correctly (matching) in the database.
The db connection is fine.
But I keep getting the error_msg. I'm still a newb so bare with me.
The id is obviously not set (is that correct?)
I did some searching and found that HTTP_GET_VARS has been depricated. Could this cause the issue, or is there something else there I'm missing?
Everything is named correctly (matching) in the database.
The db connection is fine.
But I keep getting the error_msg. I'm still a newb so bare with me.
The id is obviously not set (is that correct?)
I did some searching and found that HTTP_GET_VARS has been depricated. Could this cause the issue, or is there something else there I'm missing?
Code: Select all
// the id has to be set if not error out
if(isset($HTTP_GET_VARS['id'])){
$query = "SELECT id, when_added, author, rating, body, title, sport, cont_type from page_content where id = '$id'";
if($rs = mysql_query($query, $db_conn) and mysql_num_rows($rs) == 1){
$row = mysql_fetch_array($rs);
$arr['id'] = $row[0];
$arr['when_added'] = $row[1];
$arr['author'] = $row[2];
$arr['rating'] = $row[3];
$arr['body'] = $row[4];
$arr['title'] = $row[5];
$arr['sport'] = $row[6];
$arr['cont_type'] = $row[7];
}else{
$error = true;
$error_msg = "Item Id Not Found";
}
}else{
$error = true;
$error_msg = "Item Id Not Found";
}