mindapolis Posted August 1, 2011 Share Posted August 1, 2011 What are the causes of this error besides the misspelling of the function or the function wasn't uploaded? Fatal error: Call to undefined function get_xml_catalog() in D:\Hosting\5246561\html\treats.php Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/ Share on other sites More sharing options...
AyKay47 Posted August 1, 2011 Share Posted August 1, 2011 this error means that you have either misspelled the function when calling it, or the function simply is not defined before you try to call it...perhaps if you post some of the code I can help you out Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1249994 Share on other sites More sharing options...
mindapolis Posted August 1, 2011 Author Share Posted August 1, 2011 That would be great, thank you! <?php session_name("treats"); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Auntie Vic's treats</title> <link href="doggyTreats.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #mainContent { margin: 0 auto; text-align:center; width:600px; } .description { width: 200px; padding-left: 5px; } .price { font-weight: bold; } #catalog { margin-top: 50px; margin-left: 250px; } .products { width: 300px; text-align:center; padding-right:35px; padding-bottom: 6px; } .pics { text-align:center; } .description { padding-right: 25px; } </style> </head> <body> <div id = "navBar"> <ul id="menu"> <li class="menuOption"><a href="index.html">Home</a></li> <li class="menuOption"><a href="aboutUs.html">Management Team </a></li> <li class="menuOption"><a href="missionStatement.html">Mission Statement</a></li> <li class="menuOption"><a href="treats.html">Treats </a></li> <li class="menuOption"><a href="charities.html">Supported Charities</a></li> <li class="menuOption"><a href="order.html">Orders</a></li> </ul> </div> <div id="logo"><img src="assets/logo.gif" width="182" height="123" alt="logo" /></div> <div id = "mainContent"> <?php $output = '.<table class="product"> <tr>'; foreach(get_xml_catalog() as $product) { $output .=' <td> <h2>'.$product->title.'</h2> <div> <img src="'.$product->img.' height="" Width="" /> <span> '.$product->description.' </span> </div> <div class="price"> '.$price->price.' </div> <div class="addToCart"> <a href="#">add to cart</a> </div> </td>'; } $output .=' </tr> </table> '; echo $output; ?> </div> <div id = "footer"> Auntie Vic's Treatery <br /> PO Box 34092 <br /> Clermont, IN 46234 <br /> 317-701-0343 <br /> <a href="mailto:auntievics@gmail.com">Email Us</a></div> </body> </html> <?php /**DEFINE GLOBALS**/ define('STORE_XML_FILE' , 'catalog.xml'); /*FUNCTIONS*/ function get_xml_catalog() { return new SimpleXMLElement(file_get_contents(STORE_XML_FILE)); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1249997 Share on other sites More sharing options...
AyKay47 Posted August 1, 2011 Share Posted August 1, 2011 are you defining the function in another php file? if so, you do not include the php file before using the function Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1250003 Share on other sites More sharing options...
mindapolis Posted August 1, 2011 Author Share Posted August 1, 2011 I defined it in the functions file Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1250005 Share on other sites More sharing options...
AyKay47 Posted August 1, 2011 Share Posted August 1, 2011 then at the top of the file that you are using the function you will need to insert.. <?php session_name("treats"); session_start(); include 'path/to/functions.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1250007 Share on other sites More sharing options...
mindapolis Posted August 1, 2011 Author Share Posted August 1, 2011 oh duh, I'm such an idiot! Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1250012 Share on other sites More sharing options...
AyKay47 Posted August 1, 2011 Share Posted August 1, 2011 oh duh, I'm such an idiot! no problem... Quote Link to comment https://forums.phpfreaks.com/topic/243422-causes-for-this-error/#findComment-1250018 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.