arunkar Posted February 26, 2008 Share Posted February 26, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/ Share on other sites More sharing options...
monkeypaw201 Posted February 26, 2008 Share Posted February 26, 2008 Your best bet is to ask in the Joomla Forums. Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476688 Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 $result = mysql_query("SELECT * from jos_tellfriend order by id desc",$conn); // Here is the error see if that works Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476703 Share on other sites More sharing options...
arunkar Posted February 26, 2008 Author Share Posted February 26, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476757 Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 It sounds to me that a support file is missing error_reporting(E_ALL); add that at the beginning of the script and see if it shows up anything. Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476764 Share on other sites More sharing options...
arunkar Posted February 26, 2008 Author Share Posted February 26, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476770 Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 <?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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476775 Share on other sites More sharing options...
arunkar Posted February 26, 2008 Author Share Posted February 26, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476830 Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476836 Share on other sites More sharing options...
arunkar Posted February 26, 2008 Author Share Posted February 26, 2008 You are excellent DarkAngel!! It worked like charm. 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 Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476858 Share on other sites More sharing options...
arunkar Posted February 26, 2008 Author Share Posted February 26, 2008 You are excellent DarkAngel!! Thanks guys. I managed to fix it. it was the function again that was missing... I managed to find it... You guys rock! cheers Arun Quote Link to comment https://forums.phpfreaks.com/topic/93047-joomla-driven-php-function-error/#findComment-476884 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.