shwetapandit Posted August 1, 2013 Share Posted August 1, 2013 i am getting a notice as undefined index on line 7 which is blue colored and then below notice it shows Unknown column 'c.id' in 'field list'.my script is not working. plz suggest me the way i correct this.i am attaching the complete script in attachment.showitem.php //connect to database $mysqli = mysqli_connect("localhost", "root", "", "storefront"); $display_block = "<h1>My Store - Item Detail</h1>"; //create safe values for use $safe_item_id = mysqli_real_escape_string($mysqli, $_GET['item_id']); //validate item$get_item_sql = "SELECT c.id as cat_id, c.cat_title, si.item_title, si.item_price, si.item_desc, si.item_image FROM store_items AS si LEFT JOIN store_categories AS c on c.id = si.cat_id WHERE si.id = '".$safe_item_id."'"; Quote Link to comment Share on other sites More sharing options...
trq Posted August 1, 2013 Share Posted August 1, 2013 Does $_GET['item_id'] exist? Quote Link to comment Share on other sites More sharing options...
shwetapandit Posted August 1, 2013 Author Share Posted August 1, 2013 yes item_id exists. Quote Link to comment Share on other sites More sharing options...
DavidAM Posted August 1, 2013 Share Posted August 1, 2013 i am getting a notice as undefined index on line 7That is an indication that there is no "item_id" parameter provided in the URL (for $_GET). then below notice it shows Unknown column 'c.id' in 'field list'That indicates (based on your query) that there is no column named id in the store_categories table Check the spelling and cAsE in both cases. If the page might be requested without an item_id, then check for it before doing the query and take some appropriate action when it is not present. Hint: Any publicly available page might be requested without the expected url parameters. Quote Link to comment 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.