uswege Posted January 9, 2011 Share Posted January 9, 2011 I am trying to output from mysql database, the code i have, which is just before the opening html tag, is this below <?php include('connecting_file.php'); $catid=$_GET['cat']; $subid=$_GET['subcat']; if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_name, $pmo); $query_cat = "select * from subcat where catid='$catid'and subid='$subid'"; $cat = mysql_query($query_cat, $pmo) or die(mysql_error()); $row_cat = mysql_fetch_assoc($cat); $totalRows_cat = mysql_num_rows($cat); ?> Then i use this one to output the content from the table by just adding this code to where i want content to appear <?php echo $row_cat['content']; ?> but all i get is Notice: Undefined index: cat in C:\wamp\www\mysite\aboutus.php on line 2 Notice: Undefined index: subcat in C:\wamp\www\mysite\aboutus.php on line 3 Can someone please help me out Quote Link to comment https://forums.phpfreaks.com/topic/223856-php-outputting-script/ Share on other sites More sharing options...
Pikachu2000 Posted January 9, 2011 Share Posted January 9, 2011 Both $_GET['cat'] and $_GET['subcat'] have no value. Their values need to be sent in the URL string, and checked for before attempting to use them, or executing any code that relies on their values being present. Quote Link to comment https://forums.phpfreaks.com/topic/223856-php-outputting-script/#findComment-1157030 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.