sydewyndr Posted January 27, 2007 Share Posted January 27, 2007 Please understand that I'm very new at PHP, so I'm muddling my way through this. I'm also not really a programmer by trade. I'm getting the following error message and I've spent hours upon hours trying to figure out why. I can't find any useful tidbits online, that apply to what I'm seeing in my code: Notice: Undefined offset: 0 in /var/www/html/contentthatworks.com/modules-dev/home/scripts/index.php on line 33.If anybody can help me, I would be very appreciative, as I'm coming up against a deadline. Thanks.Here's the code in my index.php<?php $bedroom_articles = get_articles("(article_category.slug='mind')", $articles_per_category, "html", "html"); $decorate_articles = get_articles("(article_category.slug='mind')", $articles_per_category, "html", "html"); $livinganddining_articles = get_articles("(article_category.slug='mind')", $articles_per_category, "html", "html"); $organize_articles = get_articles("(article_category.slug='mind')", $articles_per_category, "html", "html"); $outdoors_articles = get_articles("(article_category.slug='mind')", $articles_per_category, "html", "html"); $kitchenandbath_articles = get_articles("(article_category.slug='mind')", $articles_per_category, "html", "html"); // select one featured article from any category, as designated by the priority flag in the article record, and show a headline, subheadline and banner for that $feature_article = get_articles("article.priority=1", 1, "html", "html"); $feature_headline = $feature_article["headline"]; $feature_subheadline = $feature_article["subheadline"]; $feature_image = $setting_article_image_address."/".get_image_by_slug($feature_article["ID"], "banner"); $feature_file_name = $feature_article["file_name"]; $feature_category = $feature_article["category"]; $feature1_article = get_articles("(article_category.slug='feature1')", 1, "html", "html"); $feature1_display_article = 0; $feature1_headline = $feature1_article["headline"]; $feature1_subheadline = $feature1_article["subheadline"]; $feature1_image = $setting_article_image_address."/".get_image_by_slug($feature1_article["ID"], "banner"); $feature1_file_name = $feature1_article["file_name"]; $feature1_category = $feature1_article["category"]; // we don't want to show the featured article twice, so get ready to skip this article in the next section $bedroom_display_article = 0; $decorate_display_article = 0; $livinganddining_display_article = 0; $organize_display_article = 0; $outdoors_display_article = 0; $kitchenandbath_display_article = 0; while (${$feature_category."_articles"}[${$feature_category."_display_article"}]["file_name"] == $feature_file_name) {${$feature_category."_display_article"}++; } ?><div style="width: 100%"> <table width="585" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="260" height="260" valign="top"><!-- show a large image for the feature article; this must be attached to each article with the "banner" slug --> <a href="<?=$feature_file_name?>"><img src="<?=$feature_image?>" border="0" alt="banner" /></a></td> <td width="315" valign="top" background="articleTubBox2.png"> <div style="padding-left: 10px;"> <p class="ctw-headline"><a href="<?=$feature_file_name?>"><?=$feature_headline?></a></p> <p class="ctw-subheadline"><a href="<?=$feature_file_name?>"><?=$feature_subheadline?></a></p> </div> <!-- Placeholder for future slideshow addition --> <div> <blockquote> <p>Coming Soon: Slideshow </p> </blockquote> </div> </td> </tr> </table> <table width="581" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="360" height="413" valign="top"><table width="340" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="176" height="206"><img src="template_images/kitDavey.png" width="176" height="206" /></td> <td width="176" height="206"><img src="template_images/lolaSmith.png" width="176" height="206" /></td> </tr> </table> <table width="354" height="200" border="0" cellpadding="2" cellspacing="0"> <tr> <td width="200" valign="top"><a href="<?=$feature1_file_name?>"><img src="<?=$feature1_image?>" border="0" alt="banner" /></a></td> <td width="140" height="206" valign="top"><p class="ctw-headline b"><a href="<?=$feature1_file_name?>"><?=$feature1_headline?></a></p> <p class="ctw-subheadline b"><a href="<?=$feature1_file_name?>"><?=$feature1_subheadline?></a></p></td> </tr> </table></td> <td width="221" height="420" valign="top"><table width="229" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="229" height="412" background="articles.png"> </td> </tr> </table></td> </tr> </table> </div> Link to comment https://forums.phpfreaks.com/topic/35954-undefined-offset-error-please-help/ Share on other sites More sharing options...
kenrbnsn Posted January 27, 2007 Share Posted January 27, 2007 Which is line 33? What does the function get_articles() do?Ken Link to comment https://forums.phpfreaks.com/topic/35954-undefined-offset-error-please-help/#findComment-170521 Share on other sites More sharing options...
sydewyndr Posted January 27, 2007 Author Share Posted January 27, 2007 Line 33 is where the While loop starts after most of the variable definitions.The function getArticles() basically goes to our MySQL db and retrieves the appropriate articles based on category or priority. Link to comment https://forums.phpfreaks.com/topic/35954-undefined-offset-error-please-help/#findComment-170524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.