Jump to content

[SOLVED] getfirst() error


mr_badger

Recommended Posts

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);

Link to comment
Share on other sites

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
  }

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.