mr_badger Posted June 5, 2007 Share Posted June 5, 2007 I'am getting an error Fatal error: Call to undefined function: getfirst() in \sitename on page 123. everything works fine on localhost. <?php do { ?> <h2><?php echo $row_getArticle['title']; ?></h2> <p><strong><span class="style1"><?php echo $row_getArticle['theDate']; ?></span></strong><span class="style1"><strong>:</strong></span> <?php $extract = getFirst($row_getArticle['article'], 2); echo $extract[0]; if ($extract[1]) { ?> <a href="blog_detail.php?article_id=<?php echo $row_getArticle['article_id']; ?>">More</a> <?php } ?></p> <?php } while ($row_getArticle = mysql_fetch_assoc($getArticle)); ?> <table width="50%" border="0" align="center" id="first_prev"> <tr> <td width="23%" align="center"><?php if ($pageNum_getArticle > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_getArticle=%d%s", $currentPage, 0, $queryString_getArticle); ?>">First</a> <?php } // Show if not first page ?> </td> <td width="31%" align="center"><?php if ($pageNum_getArticle > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_getArticle=%d%s", $currentPage, max(0, $pageNum_getArticle - 1), $queryString_getArticle); ?>">Previous</a> <?php } // Show if not first page ?> </td> <td width="23%" align="center"><?php if ($pageNum_getArticle < $totalPages_getArticle) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_getArticle=%d%s", $currentPage, min($totalPages_getArticle, $pageNum_getArticle + 1), $queryString_getArticle); ?>">Next</a> <?php } // Show if not last page ?> </td> <td width="23%" align="center"><?php if ($pageNum_getArticle < $totalPages_getArticle) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_getArticle=%d%s", $currentPage, $totalPages_getArticle, $queryString_getArticle); ?>">Last</a> <?php } // Show if not last page ?> </td> </tr> </table> I manage to get the title and date fine but nothing else. The error is this line <?php $extract = getFirst($row_getArticle['article'], 2); Quote Link to comment https://forums.phpfreaks.com/topic/54362-solved-getfirst-error/ Share on other sites More sharing options...
trq Posted June 5, 2007 Share Posted June 5, 2007 Where do you define getFirst() ? Quote Link to comment https://forums.phpfreaks.com/topic/54362-solved-getfirst-error/#findComment-268833 Share on other sites More sharing options...
mr_badger Posted June 5, 2007 Author Share Posted June 5, 2007 what do you mean by where have I defined it? Sorry if this is a stupid question. Quote Link to comment https://forums.phpfreaks.com/topic/54362-solved-getfirst-error/#findComment-268847 Share on other sites More sharing options...
trq Posted June 5, 2007 Share Posted June 5, 2007 getFirst() is not a php function. You must have defined it somewhere. Now php can't find it (and neither can you by the sounds of it... hehe). It will look something like... <?php function getFirst($a,$b) { // relevant code } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54362-solved-getfirst-error/#findComment-268849 Share on other sites More sharing options...
thefortrees Posted June 5, 2007 Share Posted June 5, 2007 like thorpe said, you have to write the getfirst() function yourself. Quote Link to comment https://forums.phpfreaks.com/topic/54362-solved-getfirst-error/#findComment-268856 Share on other sites More sharing options...
mr_badger Posted June 6, 2007 Author Share Posted June 6, 2007 Yes you are right, I had the getfirst function definition in another file and forgot to add it to the original code, thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/54362-solved-getfirst-error/#findComment-268870 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.