Jump to content

Joomla driven PHP Function Error


arunkar

Recommended Posts

Hi There,

 

I'm very new to PHP. I'm getting this below error, not sure why. This module was working fine before I

 

patched the Joomla with patch Joomla_1.0.12_to_1.0.14-Stable-Patch_Package. It had no change to this

 

module components/com_tellfriend

 

Fatal error: Call to undefined function execute() in /chroot/home/buy1-

 

give1free/components/com_tellfriend/tellfriend.php on line 221

 

Here is the code:

 

function defaulttellfriend($option)

{

global $mainframe, $database, $my;

global $mosConfig_live_site, $conn;

global $Itemid;

 

/* Query to retrieve all categories that belong under the contacts section and that are published. */

 

$result = execute("SELECT * from jos_tellfriend order by id desc",$conn); // Here is the error

$get_rows_count = get_rows_count($result);

 

if($get_rows_count > 0)

{

while($row = get_row($result))

{

$data[] = $row;

}

}

HTML_tellfriend::defaulttellfriend($data,$option);

}

 

Thanks

 

Arun

Link to comment
Share on other sites

Thanks DarkAngle!

 

but that throws errors on this line now:

 

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.php on line 222

 

Fatal error: Call to undefined function get_rows_count() in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.php on line 225

 

        $result = mysql_query("SELECT * from jos_tellfriend order by id desc",$conn); // Here is the error Line 222

 

 

$get_rows_count = get_rows_count($result); // Line 225

 

 

Arun

 

Link to comment
Share on other sites

I'm getting the same err, upon including the code "error_reporting(E_ALL);"

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.php on line 222

 

Fatal error: Call to undefined function get_rows_count() in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.php on line 225

 

 

Link to comment
Share on other sites

<?php

function defaulttellfriend($option)
{
global $mainframe, $database, $my;
global $mosConfig_live_site, $conn;
global $Itemid;

/* Query to retrieve all categories that belong under the contacts section and that are published. */

$result = mysql_query("SELECT * from jos_tellfriend order by id desc"); // Here is the error
$get_rows_count = mysql_num_rows($result);

if($get_rows_count > 0)
{
while($row = mysql_fetch_array($result))
{
$data[] = $row;
}
}
HTML_tellfriend::defaulttellfriend($data,$option);
}

?>

Link to comment
Share on other sites

Wonderful DarkAngel!  :)

 

it worked on the page. It showed the same error on next page so I applied your code and now it's throwing

 

Fatal error: Call to undefined function get_row() in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.html.php on line 35

 

code here:

 

class HTML_tellfriend

{

function defaulttellfriend($option)

{

  $com = "com_tellfriend";

  global $Itemid, $mosConfig_live_site, $hide_js, $conn;

  $type = $_GET['type'];

// $result = execute("SELECT * from jos_tellfriend where actiontype='" . $type ."'", $conn);

// $get_rows_count = get_rows_count($result);

$result = mysql_query("SELECT * from jos_tellfriend order by id desc");

$get_rows_count = mysql_num_rows($result);

 

  if($get_rows_count > 0) // here is the Error Line 35

  {

$data = get_row($result);

  }  

  session_start();

  ?>

how now?

Link to comment
Share on other sites

Wonderful DarkAngel!  :)

 

it worked on the page. It showed the same error on next page so I applied your code and now it's throwing

 

Fatal error: Call to undefined function get_row() in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.html.php on line 35

 

code here:

 

class HTML_tellfriend

{

function defaulttellfriend($option)

{

  $com = "com_tellfriend";

  global $Itemid, $mosConfig_live_site, $hide_js, $conn;

  $type = $_GET['type'];

// $result = execute("SELECT * from jos_tellfriend where actiontype='" . $type ."'", $conn);

// $get_rows_count = get_rows_count($result);

$result = mysql_query("SELECT * from jos_tellfriend order by id desc");

$get_rows_count = mysql_num_rows($result);

 

  if($get_rows_count > 0) // here is the Error Line 35

  {

$data = get_row($result);

  }  

  session_start();

  ?>

how now?

 

my edits where

 

execute is mysql_query with the  ", $conn" at the end removed

 

get_rows_count is mysql_num_row

 

get_row is mysql_fetch_array

 

 

 

 

instead of editing all the files

 

it might be easier to create the functions

 

<?php
function execute($sql, $whocares) {
     return mysql_query($sql);
}

function get_row($query) {
     return mysql_fetch_array($query);
}

function get_rows_count($query) {
     return mysql_num_rows($query);
}
?>

 

You can save that as something like missingfunction.inc.php

 

and

 

require("missingfunction.inc.php"); // Somewhere in your scripts

Link to comment
Share on other sites

You are excellent DarkAngel!!

 

It worked like charm.  ;D

 

When I just recommended a friend using this page poof It threw another  error:

 

Fatal error: Call to undefined function update_data() in /chroot/home/buy1-give1free/components/com_tellfriend/tellfriend.php on line 175

 

Code:

$sql_array=array("logdate"=>'now()',

 

  "actiontype"=>$type,

                "sendername"=>$yourname,

"senderemail"=>$youremail,

                "messagesent"=>$emailmessage,

"nopeoplesentto"=>$count

);

 

update_data("jos_tellfriendlog",$sql_array,$conn); //Here is the error Line 175

 

mosRedirect( "index.php?option=com_tellfriend&type=$type&err=2" );

}

else

{

  $err = "Please check your verification code";

  $_SESSION['b1g1emailmessage'] = $_POST['b1g1emailmessage'];

  $_SESSION['yourname'] = $_POST['yourname'];

  $_SESSION['youremail'] = $_POST['youremail'];

  $_SESSION['email1'] = $_POST['email1'];

  $_SESSION['email2'] = $_POST['email2'];

      $_SESSION['email3'] = $_POST['email3'];

  $_SESSION['email4'] = $_POST['email4'];

  $_SESSION['email5'] = $_POST['email5'];

  $_SESSION['email6'] = $_POST['email6'];

  $_SESSION['email7'] = $_POST['email7'];

  $_SESSION['email8'] = $_POST['email8'];

 

  mosRedirect( "index.php?option=com_tellfriend&type=$type&err=1");

}

 

what should I do now?

 

Arun

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.