Monkuar Posted February 7, 2012 Share Posted February 7, 2012 are you freaking kidding me or am i just gone dead? if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ $subforums = " {$info['subforums1']} {$info['subforums']}"; } I fixed the $cookie['subforum'] and added the isset, but now it's saying my subforums1 and subforums are UNDEFINED? Is this a joke? it's not a INPUT it's simply a variable from my DATABASE .... being called? this is my hole heredoc return <<<EOF <tr $color> <td style=border-left:none><b><span class="forumhover"><a href="{$ibforums->base_url}z={$info['id']}" title='{$info['description']}'>{$info['name']}</a></span> </b> <span class='desc'> $subforums <br></span>$moderator</span></td> <td align='center' nowrap><span class=desc4>Posts:</span> {$info['posts']}<br> <span class=desc4>Topics:</span> {$info['topics']} </td> <td> » <b>{$info['last_topic']}</b></span> <br><span class="forumhover3">{$ibforums->lang['by']} {$info['last_poster']} <span class="desc4">{$info['last_post']}</span> </span> </td> </tr> EOF; ONLY the SUBFORUMS are being UNDEFINED the other $info's like post's,last_posters,last_post ARE NOT Showing errors but the subforums one are? this is literally making me tear my hair out, this is outrageous! any idea why it would do this? pissing me off, I never had to isset those other $info's and it's not calling them as undefined error's but hell whenever I try to code my own mods/etc it always doesn't work the way I want, pathetic, i hate myself and I hate this isset STUFF, does it even effect performance that much? this is just getting ridiclious Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/ Share on other sites More sharing options...
trq Posted February 7, 2012 Share Posted February 7, 2012 Where is $info defined? Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315306 Share on other sites More sharing options...
Monkuar Posted February 7, 2012 Author Share Posted February 7, 2012 Where is $info defined? $forum_data['subforums1'] = '<br> <img src=style_images/1/subforum.png> <span class=desc4>Subforums:</span>'; it is there then my subforums are $subforums[] = "<a href=\"?z={$data['id']}\">{$data['name']}</a>"; $forum_data['subforums'] = implode(', ', $subforums); that is inside a Array. The problem is, all the other $info's ARE NOT DEFINED and they don't show any errors! How in the hell (and why) does my subforums need to be defined also? I search for $info['description'] and the only thing I can find to call that is the row name description getting pulled from a database query, there is no ISSET related to $info description or any of the other $info's so why in the worlds hell, is the subforum ones being error'd out, it makes absolutely no sense! (Same for all the other $info's are not defined either and i get no error's from them) it's MERELY Pulling stuff from a DATABASE, you don't need to define database values? something wrong with my php Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315309 Share on other sites More sharing options...
trq Posted February 7, 2012 Share Posted February 7, 2012 You haven't showed us where $info is defined. Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315311 Share on other sites More sharing options...
trq Posted February 7, 2012 Share Posted February 7, 2012 (Same for all the other $info's are not defined either and i get no error's from them) it's MERELY Pulling stuff from a DATABASE, you don't need to define database values? You do need to make sure they have been selected in your query. Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315312 Share on other sites More sharing options...
Monkuar Posted February 7, 2012 Author Share Posted February 7, 2012 You haven't showed us where $info is defined. function ForumRow($info) { global $ibforums; $color_one = 'class="rowpk"'; $color_two = ''; static $i = 0; $color = ($i % 2) ? $color_one : $color_two; $i++; if ($info['description']){ $info['description'] = "<br>{$info['description']}"; }else{ $info['description'] = ""; } if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ $subforums = " {$info['subforums1']} {$info['subforums']}"; } if (isset($info['moderator'])){ $moderator = $info['moderator']; } // <td style="border-left:none">{$info['img_new_post']}</td> return <<<EOF <tr $color> <td style=border-left:none><b><span class="forumhover"><a href="{$ibforums->base_url}z={$info['id']}" title='{$info['description']}'>{$info['name']}</a></span> </b> <span class='desc'> $subforums <br></span>$moderator</span></td> <td align='center' nowrap><span class=desc4>Posts:</span> {$info['posts']}<br> <span class=desc4>Topics:</span> {$info['topics']} </td> <td> » <b>{$info['last_topic']}</b></span> <br><span class="forumhover3">{$ibforums->lang['by']} {$info['last_poster']} <span class="desc4">{$info['last_post']}</span> </span> </td> </tr> EOF; } function ForumRow($info) { let me find $info return $this->html->ForumRow($forum_data); so it's coming from $forum_data, then right? and all the other $info's ($forum_data) do not use any type of isset (merely just stuff being called from a database from a loop, that is why in the hell does the subforum one get error'd out??) Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315313 Share on other sites More sharing options...
Monkuar Posted February 7, 2012 Author Share Posted February 7, 2012 Okay i fixed it if (isset($info['subforums1'])){ $subforums = " {$info['subforums1']} {$info['subforums']}"; } dude this isset stuff is just literally retarded, there is NO means on why this should be used, is there any edited php librarys that have the isset stuff disabled? This is going to take forever to isset every stupid variable "just cuz" when everything work absolutely fine if it does not have a isset to it (for my coding style) i should have never used isset because this stuff is being called from a database should be no reason why it needs to be "defined" rofl, this is a joke Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315318 Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2012 Share Posted February 7, 2012 So, did you actually find out why the subforums1 index does not exist when the code is expecting the data from the query to have that index in it? Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315322 Share on other sites More sharing options...
Monkuar Posted February 7, 2012 Author Share Posted February 7, 2012 i fixed subforums1 now for subforums Undefined variable: subforums if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ if (isset($info['subforums1']) && isset($info['subforums']) && isset($subforums) ) { $subforums = " {$info['subforums1']} {$info['subforums']}"; } } I tried to isset my $subforums variable but still it's calling it undefined? hmm im simply echoing out $subforums ? so weird rofl Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315324 Share on other sites More sharing options...
kicken Posted February 7, 2012 Share Posted February 7, 2012 If you use var_dump($info); it will show you the entire content of $info and which keys are defined. Then when you see your keys are missing just trace the execution backwards and figure out why they are missing. My guess? You have a mix of some forums which both do and don't contain any sub forums. For forums that have no subforums, you never define those keys. Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315326 Share on other sites More sharing options...
Monkuar Posted February 7, 2012 Author Share Posted February 7, 2012 If you use var_dump($info); it will show you the entire content of $info and which keys are defined. Then when you see your keys are missing just trace the execution backwards and figure out why they are missing. My guess? You have a mix of some forums which both do and don't contain any sub forums. For forums that have no subforums, you never define those keys. wow var_dump is awesome, thanks 4 telling me that array 'id' => string '20' (length=2) 'topics' => string '1' (length=1) 'posts' => string '0' (length=1) 'last_post' => string '2 weeks 6 days ago' (length=19) 'last_poster_id' => string '1' (length=1) 'star' => string '' (length=0) 'last_poster_name' => string 'Newman' (length=6) 'name' => string 'Site Announcements' (length=18) 'description' => string '' (length=0) 'position' => string '1' (length=1) 'status' => string '1' (length=1) 'start_perms' => string '4' (length=1) 'reply_perms' => string '4' (length=1) 'read_perms' => string '*' (length=1) 'password' => string '' (length=0) 'category' => string '3' (length=1) 'last_title' => string 'New Site Design/Updates' (length=23) 'last_id' => string '281' (length=3) 'prune' => string '30' (length=2) 'preview_posts' => string '0' (length=1) 'allow_poll' => string '1' (length=1) 'allow_pollbump' => string '0' (length=1) 'parent_id' => string '-1' (length=2) 'subwrap' => string '0' (length=1) 'sub_can_post' => string '1' (length=1) 'quick_reply' => string '0' (length=1) 'has_mod_posts' => string '0' (length=1) 'topic_mm_id' => string '' (length=0) 'topic_thread' => string '1' (length=1) 'editable' => string 'global' (length=6) 'edit_time' => string '0' (length=1) 'cat_id' => string '3' (length=1) 'cat_position' => string '1' (length=1) 'cat_state' => string '1' (length=1) 'cat_name' => string 'SWR' (length=3) 'cat_desc' => string '' (length=0) 'image' => string '' (length=0) 'url' => string '' (length=0) 'mod_name' => null 'mod_id' => null 'is_group' => null 'group_id' => null 'group_name' => null 'mid' => null 'img_new_post' => string '<div class=forumoff></div>' (length=26) 'last_topic' => string '<a href='http://localhost/?t=281&x=1' title='Go To Last Page'>New Site Design/Updates</a>' (length=93) 'last_unread' => string '<a href='http://localhost/?showtopic=281&view=getlastpost' title='Go to the last post'><{LAST_POST}></a>' (length=108) 'last_poster' => string '<a href='http://localhost/?i=1'>Newman</a>' (length=42) 'moderator' => string '' (length=0) i guess sometimes it does not show subforums hence (forum has no subforums) which you are correct,h ow would I go about making those forums with no subforums isset? array 'id' => string '13' (length=2) 'topics' => string '21' (length=2) 'posts' => string '264' (length=3) 'last_post' => string '3 days 1 hour ago' (length=18) 'last_poster_id' => string '1' (length=1) 'star' => string '<img class='top3' src='style_images/1/icons/127.png'>' (length=53) 'last_poster_name' => string 'Newman' (length=6) 'name' => string 'Entertainment & Lifestyle' (length=29) 'description' => string '' (length=0) 'position' => string '2' (length=1) 'status' => string '1' (length=1) 'start_perms' => string '3,4,6,7' (length=7) 'reply_perms' => string '3,4,6,7' (length=7) 'read_perms' => string '*' (length=1) 'password' => string '' (length=0) 'category' => string '1' (length=1) 'last_title' => string 'Favorite Sport/Athlete?' (length=23) 'last_id' => string '114' (length=3) 'prune' => string '30' (length=2) 'preview_posts' => string '0' (length=1) 'allow_poll' => string '1' (length=1) 'allow_pollbump' => string '0' (length=1) 'parent_id' => string '-1' (length=2) 'subwrap' => string '1' (length=1) 'sub_can_post' => string '1' (length=1) 'quick_reply' => string '0' (length=1) 'has_mod_posts' => string '0' (length=1) 'topic_mm_id' => string '' (length=0) 'topic_thread' => string '1' (length=1) 'editable' => string 'global' (length=6) 'edit_time' => string '0' (length=1) 'cat_id' => string '1' (length=1) 'cat_position' => string '2' (length=1) 'cat_state' => string '1' (length=1) 'cat_name' => string 'Off Topic' (length=9) 'cat_desc' => string '' (length=0) 'image' => string '' (length=0) 'url' => string '' (length=0) 'mod_name' => null 'mod_id' => null 'is_group' => null 'group_id' => null 'group_name' => null 'mid' => null 'fid' => string '13' (length=2) 'subforums1' => string '<br> <img src=style_images/1/subforum.png> <span class=desc4>Subforums:</span>' (length=97) 'subforums' => string '<a href="?z=18">The Salon & Barbershop</a>, <a href="?z=14">Sports</a>, <a href="?z=15">Movies & Television</a>, <a href="?z=16">Nutrition & Exercise</a>, <a href="?z=17">Technology & Gaming</a>' (length=210) 'last_unread' => string '<a href='http://localhost/?showtopic=114&view=getlastpost' title='Go to the last post'><{LAST_POST}></a>' (length=108) 'last_topic' => string '<a href='http://localhost/?t=114&x=1' title='Go To Last Page'>Favorite Sport/Athlete?</a>' (length=93) 'last_poster' => string '<a href='http://localhost/?i=1'>Newman</a><img class='top3' src='style_images/1/icons/127.png'>' (length=95) 'img_new_post' => string '<div class=forumoff></div>' (length=26) that 1 shows subforums too i tried if (isset($forum_data['subforums'])){ $forum_data['subforums'] = implode(', ', $subforums); } no errors buit not working? Quote Link to comment https://forums.phpfreaks.com/topic/256576-how-can-php-undefined-index-a-freaking-row-value/#findComment-1315330 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.