PHP - Call To Undetified Method?
Call to undefined method skin_register::show_lostpass_form() in /var/www/sources/reg.php on line 1042
1042: Code: [Select] $this->output = $this->html->show_lostpass_form(); my html function show_lostpass_form(); is Code: [Select] function show_lostpass_form_manual() { global $ibforums; return <<<EOF <div class="tablepad">{$ibforums->lang['dumb_text']}</div> <div class="pformstrip">{$ibforums->lang['complete_form']}</div> <table class="tablebasic"> <tr> <td class="pformleft"><strong>{$ibforums->lang['user_id']}</strong></td> <td class="pformright"><input type='text' size='32' maxlength='32' name='uid' class='forminput' /></td> </tr> <tr> <td class="pformleft"><strong>{$ibforums->lang['val_key']}</strong></td> <td class="pformright"><input type='text' size='32' maxlength='50' name='aid' class='forminput' /></td> </tr> EOF; } why this error not going away? :O Similar TutorialsOVERVIEW: The code is about making call to the escreen web service using SOAP and Curl with client authentication required. Currently I am not getting any result only HTTP 403 and 500 errors. The call requires client authenticate cert to be on the callng site. CODE: $content = "<TicketRequest> <Version>1.0</Version> <Mode>Test</Mode> <CommitAction></CommitAction> <PartnerInfo> <UserName>xxxxxxxxxx</UserName> <Password>xxxxxxxxxxx</Password> </ PartnerInfo> <RequestorOrderID></RequestorOrderID> <CustomerIdentification> <IPAddress></IPAddress> <ClientAccount>xxxxxxxxxx</ClientAccount> <ClientSubAccount>xxxxxxxxxx</ClientSubAccount> <InternalAccount></InternalAccount> <ElectronicClientID></ElectronicClientID> </CustomerIdentification> <TicketAction> <Type></Type> <Params> <Param> <ID>4646</ID> <Value></Value> </Param> </Params> </TicketAction> </TicketRequest>"; $wsdl = "https://services.escreen.com/SingleSignOnStage/SingleSignOn.asmx"; $headers = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", // "SOAPAction: \"\"", "Content-length: ".strlen($content), ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $wsdl); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $content); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1'); //curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //curl_setopt($ch, CURLOPT_HTTPHEADER, array('SOAPAction: ""')); curl_setopt($ch, CURLOPT_CAPATH, '/home/pps/'); curl_setopt($ch, CURLOPT_CAINFO, '/home/pps/authority.pem'); curl_setopt($ch, CURLOPT_SSLCERT, 'PROTPLUSSOL_SSO.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'xxxxxxxxxxxx'); $output = curl_exec($ch); // Check if any error occured if(curl_errno($ch)) { echo 'Error no : '.curl_errno($ch).' Curl error: ' . curl_error($ch); } print_r($output); QUESTIONS: 1. I need to call the RequestTicket method and pass the XML string to it. I don't know how to do it here(pass the method name to call). 2. For client authentication they gave us three certs, one root cert, one intermediate cert and a client authentication cert PROTPLUSSOL_SSOpem(it was a .pfx file). Since we are on linux we converted them to pem . In curl calls I could not find way to how to include both the root cert and the intermediate cert ,so I combined them by making a new pem file and copying the intermediate cert and them the root cert and naming it authority.pem . I am not sure whether it works or not and would like your opinion. 3. For the current code Iam getting the error Error no : 77 Curl error: error setting certificate verify locations: CAfile: /home/pps/authority.pem CApath: /home/pps/ If I disable the curl error message,I am getting blank page with page title 403 - Forbidden. Access is denied. If I comment out the CURLOPT_CAPATH and CURLOPT_CAINFO lines it gives http 500 error page with the message as content and the following at the top. > HTTP/1.1 500 Internal Server Error. Cache-Control: private Content-Type: text/html Server: Microsoft-IIS/7.5 X-AspNet-Version: 1.1.4322 X-Powered-By: ASP.NET Date: Thu, 02 Sep 2010 14:46:38 GMT Content-Length: 1208 If I comment out as above and also CURLOPT_SSLCERT and CURLOPT_SSLCERTPASSWD it gives 403 error with the message as content. So I would request you to help me out by pointing out whats wrong with the current code. Thank you. I have a class called cid which contains these functions: Code: [Select] public function UpdateDeliveryAddress($orderNumber, $deliveryaddress) { $sql = "UPDATE `CIDOrders` SET `DeliveryAddress` = '" . mysql_real_escape_string($deliveryaddress) . "' WHERE `CIDOrderNumber` = " . $orderNumber . ";"; mysql_select_db(DB_DATABASE_NAME, $this->conn); return mysql_query($sql, $this->conn); } public function UpdateInvoiceAddress($orderNumber, $invoiceAddress) { $sql = "UPDATE `CIDOrders` SET `InvoiceAddress` = '" . mysql_real_escape_string($invoiceaddress) . "' WHERE `CIDOrderNumber` = " . $orderNumber . ";"; mysql_select_db(DB_DATABASE_NAME, $this->conn); return mysql_query($sql, $this->conn); } It is called in a page called create order. Code: [Select] / Add a new delivery address to the order $cid->UpdateDeliveryAddress($_POST['orderNumber'], $_POST['deliveryaddress']); // Add invoice address to the order $cid->UpdateInvoiceAddress($_POST['orderNumber'], $_POST['invoiceaddress']); I get a call to undefined method error. Can anyone help me. thank you class MyDisplay { function displayToday() { $today = "Thursday"; { echo $today; } } function displayTomorrow() { $tomorrow = "Friday"; { echo $tomorrow; } } } $disp = new MyDisplay(); echo $disp->displayToday(); echo displayTomorrow();//fails is I have $disp->I simplified my code for explanation. One class with two methods. When I try to use the method I get this error. Fatal error: Call to undefined method MyDisplay::displayTomorrow() Edited by mallen, 05 June 2014 - 02:46 PM. So I have this code that generates a random ID class Session { var $username; //Username given on sign-up var $userid; //Random value generated on current login ... ... function Session(){ $this->time = time(); $this->startSession(); } ... ... $this->userid = $_SESSION['userid'] = $this->generateRandID(); ... ... function generateRandID(){ return md5($this->generateRandStr(16)); } and when it runs i get this error... Fatal error: Call to undefined method Session::generateRandID() Any ideas? HI guys, i am using 'Spreadsheet excel writer' to write form data into an excel sheet. below is my code snippet, uses to add worksheets, iam getting an error, which is really breaking me. can u please have a look at this, and help me. Code: [Select] <?php $xml = simplexml_load_file("featureDetail.xml"); require_once 'Spreadsheet/Excel/Writer.php'; $excel = new Spreadsheet_Excel_Writer(); $sheet =& $excel->addWorksheet('Home'); $sheet->setColumn(0,0,29); foreach($xml->FEATURE as $feature) { global $excel; $value=html_entity_decode($feature->NAME); echo " Value = $value"; echo "<br>"; $sheet123 =& $excel->addWorksheet('$value'); $sheet123->setColumn(0,0,29); } foreach($xml->FEATURE as $feature) { $sheet =& $excel->addWorksheet(html_entity_decode($feature->NAME)); $sheet->setColumn(0,0,29); } ?> Fatal error: Call to undefined method PEAR_Error::setColumn() in D:\xampp\htdocs\Release9.0\example.php on line 14 Well I have a library file class_database.php which defines a class called 'database' and a method called 'get' to retrieve database info. It was originally designed to return a two-dimensional array with the format of $array['index']['associative']. Right now I want to change this so as to return a result, which can then be used in other script files to retrieve data by using the fetch_array() method after getting this result. It doesnt work though, and I got this error 'Call to undefined method mysqli_stmt::get_result()', which confuses me... The two methods get() and _buildQuery are shown below, please help me figure out how to return an Mysql result so that I can use while($row = $db->get()->fetch_array()) on it with flexibility... The method get() Code: [Select] public function get($tableName, $numRows = NULL) { $this->_query = "SELECT * FROM $tableName"; $stmt = $this->_buildQuery($numRows); $stmt->execute(); $results = $stmt->get_result(); $this->reset(); return $results; } The method _buildQuery is shown below: Code: [Select] protected function _buildQuery($numRows = NULL, $tableData = NULL) { (gettype($tableData) === 'array') ? $hasTableData = true : $hasTableData = false; (!empty($this->_where )) ? $hasConditional = true : $hasConditional = false; // Did the user call the "where" method? if (!empty($this->_where)) { // if update data was passed, filter through and create the SQL query, accordingly. if ($hasTableData) { $i = 1; $pos = strpos($this->_query, 'UPDATE'); if ( $pos !== false) { foreach ($tableData as $prop => $value) { // determines what data type the item is, for binding purposes. $this->_paramTypeList .= $this->_determineType($value); // prepares the reset of the SQL query. ($i === count($tableData)) ? $this->_query .= $prop . ' = ?': $this->_query .= $prop . ' = ?, '; $i++; } } } //Prepair the where portion of the query $this->_query .= ' WHERE '; $i = 1; foreach ($this->_where as $column => $value) { // Determines what data type the where column is, for binding purposes. $this->_whereTypeList .= $this->_determineType($value); // Prepares the reset of the SQL query. ($i === count($this->_where)) ? $this->_query .= $column . ' = ?': $this->_query .= $column . ' = ? AND '; $i++; } } // Determine if is INSERT query if ($hasTableData) { $pos = strpos($this->_query, 'INSERT'); if ($pos !== false) { //is insert statement $keys = array_keys($tableData); $values = array_values($tableData); $num = count($keys); // wrap values in quotes foreach ($values as $key => $val) { $values[$key] = "'{$val}'"; $this->_paramTypeList .= $this->_determineType($val); } $this->_query .= '(' . implode($keys, ', ') . ')'; $this->_query .= ' VALUES('; while ($num !== 0) { ($num !== 1) ? $this->_query .= '?, ' : $this->_query .= '?)'; $num--; } } } // Did the user set a limit if (isset($numRows)) { $this->_query .= " LIMIT " . (int) $numRows; } // Prepare query $stmt = $this->_prepareQuery(); // Prepare table data bind parameters if ($hasTableData) { $this->_bindParams[0] = $this->_paramTypeList; foreach ($tableData as $prop => $val) { array_push($this->_bindParams, &$tableData[$prop]); } } // Prepare where condition bind parameters if($hasConditional) { if ($this->_where) { $this->_bindParams[0] .= $this->_whereTypeList; foreach ($this->_where as $prop => $val) { array_push($this->_bindParams, &$this->_where[$prop]); } } } // Bind parameters to statment if ($hasTableData || $hasConditional){ call_user_func_array(array($stmt, 'bind_param'), $this->_bindParams); } return $stmt; } I'm working on an application and it seems that the else block is being executed no matter what in the following if statement. My question (which seems really basic and like I should know the answer but I can't seem to remember) is if you have an object instance in an if statement, how does that resolve? Will it resolve to true because there is an object there? I assume/think that would be the behaviour but I can't remember. Also, I'll point out the class I'm working with is Zend_Mail. From my understanding the send method will return an instance of $this upon success and will throw an exception on failure. The mail is being sent but the else block is executing anyway. I may just throw it in a try catch if that's better. Code: [Select] if ($mail->send()) { return true; } else { $NOTICE++; $NOTICESTR[] = "We were unable to e-mail an e-mail notification <strong>".$to["email"]."</strong>.<br /><br />A system administrator was notified of this issue, but you may wish to contact this learner manually and let them know their accommodation has been removed."; application_log("error", "Unable to send accommodation notification to [".$to["email"]."] / type [".$type."]. Zend_Mail said: ".$mail->ErrorInfo); } Thanks in advance. I'll check back in a bit. So i read the docs on this and it said to create a callback function and use ini_set to set the function. I am trying to serialize an array with the class inside the array Code: [Select] $dd_normal_button = array ( 'dd_normal_button_display' => array ( 'dd_button_digg' => __PHP_Incomplete_Class::__set_state(array( '__PHP_Incomplete_Class_Name' => 'DD_Digg', 'buttonLayout' => array ( 'Wide' => 'DiggWide', 'Normal' => 'DiggMedium', 'Compact' => 'DiggCompact', 'Icon' => 'DiggIcon', ), ) ) ) ); So then I try Code: [Select] serialize($dd_normal_button); and I get the error. Any ideas/suggestions. Thanks Hello, I have no idea where to post this but basically I am trying to create a facebook application using a "Building Facebook Applications For Dummies" book but I am stuck on the first paragraph! This is the appinclude.php file: Code: [Select] <?php require_once '../client/facebook.php'; // *** Add your Facebook API Key, Secret Key, and Callback URL here *** $appapikey = '<xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>'; $appsecret = '<xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>'; $appcallbackurl = '<http://projectstratos.com/facebook/live/>'; // Connect to Facebook, retrieve user $facebook = new Facebook($appapikey, $appsecret); // $user = $facebook->require_login(); OLD $user = $facebook->get_loggedin_user(); $is_logged_out = !$user; // Exception handler for invalid session_keys try { // If app is not added, then attempt to add if (!$facebook->api_client->users_isAppAdded()) { $facebook->redirect($facebook->get_add_url()); } } catch (Exception $ex) { // Clear out cookies for app and redirect user to a login prompt $facebook->set_user(null, null); $facebook->redirect($appcallbackurl); } ?> And this is the index.php file: Code: [Select] <h1>Watch Project Stratos Live!</h1> <?php require_once 'appinclude.php'; echo "<p>Your user id is: $user</p>"; echo "<p>Your name is: <fb:name uid=\"$user\" useyou\"false\" /></p>"; echo "<p>You have several freinds: </p>"; $friends = $facebook->app_client->friends_get(); echo "<ul>"; foreach ($friends as $friend) { echo "<li><fb:name uid=\"$freind\" useyou\"false\" /></li>"; } echo "</ul>"; ?> The facebook.php is the current fbml version (v2.1.2-4 I think) and the content in the h1 tag is echoed however after that there is the following errror message: Code: [Select] Fatal error: Call to undefined method Facebook::get_loggedin_user() in /xxxxxx/xxxxxx/xxxxxx/xxxx/xxxxxxxxxxxxxxxxxxxxxx/facebook/live/appinclude.php on line 12 I have mo idea what the problem could be! I have tried changing get_loggedin_user to getUser() but I just get another error, this is aparently (according to another forum) because I "forgot" to add get_loggedin_user. Thanks in advance, Cameron This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=321957.0 Using simple mail.php script. Yet I am getting the dreaded Fatal error: Call to undefined method Mail::AddAttachment() in ... error
"Fatal error: Call to undefined method Mail::AddAttachment() in \\...\www\mail.php on line 59"
This is mail.php
<?php class Mail { var $parts; var $to; var $cc; var $bcc; var $from; var $headers; var $subject; var $body; var $html; var $host; var $port; function __construct() { $this->parts = array(); $this->to = ""; $this->cc = ""; $this->bcc = ""; $this->from = ""; $this->subject = ""; $this->body = ""; $this->headers = ""; $this->html = true; } function buildMultipart() { $boundry = "HKC".md5(uniqid(time())); $multipart = "Content-Type: multipart/mixed; boundary = \"$boundry\"\n\n"; $multipart .= "This is a MIME encoded message.\n\n--$boundry"; for($i = sizeof($this->parts)-1; $i >= 0; $i--) { $multipart .= "\n".$this->buildMessage($this->parts[$i])."--$boundry"; } return $multipart .= "--\n"; } function getMail($complete = true) { $mime = ""; if(!empty($this->from)) { $mime .= "From: ".$this->from."\n"; } if(!empty($this->headers)) { $mime .= $this->headers."\n"; } if($complete) { if(!empty($this->cc)) { $mime .= "Cc: ".$this->cc."\n"; } if(!empty($this->bcc)) { $mime .= "Bcc: ".$this->bcc."\n"; } if(!empty($this->subject)) { $mime .= "Subject: ".$this->subject."\n"; } } if(!empty($this->body)) { $this->AddAttachment($this->body,"",($this->html?"text/html":"text/plain")); } $mime .= "MIME-Version: 1.0\n".$this->buildMultipart(); return $mime; } function send() { if(!empty($this->cc)) { $mime = $this->getMail(true); } else { $mime = $this->getMail(false); } if(!empty($this->host)) { ini_set("SMTP",$this->host); } return mail($this->to,$this->subject,$this->body,$mime); } } ?>And this is the program that makes the call: <?php if (isset($_POST["email"])) { $email = $_POST["email"]; $email= str_replace("'", "''", $email); require_once('../database.php'); $sql="select fa_id,name from freeagents where email='".$email."'"; $emailSearch = mssqlquery($sql); if (!mssqlhasrows($emailSearch)) { mssqlclose(); header("Location: http://www.baltimorebeach.com"); exit(); } $row = mssqlfetchassoc($emailSearch); mssqlclose(); $salt=$row["fa_id"].".baltimorebeach."; $check=hash('ripemd160', $salt.$email); $strMailBody = <<<MAILBODY Hi $row[name], <br><br> A request was made to change your Baltimore beach volleyball free agent registration information. <br><br> If you want to update your registration information click on this link: http://www.baltimorebeach.com/FreeAgents/registerfreeagent.php?email=$email&check=$check <br><br> To remove your name from the Free Agent list deselect all the checkboxes when you update your information. MAILBODY; require_once('../mail.php'); $message = new Mail(); $message->from = "noreply@baltimorebeach.com"; $message->to = $email; $message->subject = "Baltimore Beach Volleyball Free Agent Registration Update Link"; $message->body = $strMailBody; $message->html = true; $message->send(); } ?> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script> <style type="text/css"> label.error { color:red; } input.error { border:1px solid red; } </style> <script type="text/javascript"> $().ready(function () { // validate registration form on keyup and submit $("#emailform").validate({ rules: { email: { required: true, email: true } }, messages: { email: { required: "Please enter an email address", email: "Please enter a valid email address" } } }); }); </script> </head> <body> To update your free agent registration information enter your email to send yourself a baltimorebeach.com url link that will allow you to access your own registration details. <br> To remove yourself from the free agent list just deselect all the leagues you have previously selected when updating your information. <br> <br> <?php if (!isset($_POST["email"])) { ?> <form id="emailform" action="sendlink.php" method="post"> E-Mail: <input type="text" id="email" name="email" value=""/> <br> <input type="submit" id="sumbit" value="Send"> </form> <?php } else { echo "E-Mail Sent. "."You will receive an email with the update link at the email address your requested shortly"; } ?> </body> </html>I did not write this code, however the person who did is no longer available to me. I can't seem to figure out how to remove this error. Thanks so much! Hello, I've been following google maps with php/mysql turorial http://code.google.com/apis/maps/articles/phpsqlajax.html I've come to my phpsqlajax_genxml.php file which as the google code has it like this: <?php require("phpsqlajax_dbinfo.php"); // Start XML file, create parent node $doc = domxml_new_doc("1.0"); $node = $doc->create_element("markers"); $parnode = $doc->append_child($node); // Opens a connection to a MySQL server $connection=mysql_connect (localhost, $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE $node = $doc->create_element("marker"); $newnode = $parnode->append_child($node); $newnode->set_attribute("name", $row['name']); $newnode->set_attribute("address", $row['address']); $newnode->set_attribute("lat", $row['lat']); $newnode->set_attribute("lng", $row['lng']); $newnode->set_attribute("type", $row['type']); } $xmlfile = $doc->dump_mem(); echo $xmlfile; ?> I started with this but was getting errors at line 1!! I looked around abit on the net and found i should change $doc = domxml_new_doc("1.0"); to this $doc = new DOMDocument('1.0'); Then i got errors abour creating the elements, i looke on php.net and it looked like i needed to change $node = $doc->create_element("markers"); $parnode = $doc->append_child($node); $newnode->set_attribute("name", $row['name']); To this: $node = $doc->createElement('markers'); $parnode = $doc->appendChild($node); $newnode->setAttribute ('name', $row['name']); This at least got my code further down the page until the very last statment: $xmlfile = $doc->dump_mem(); Here i'm getting this error "Fatal error: Call to undefined method DOMDocument::dump_mem()" along with "Warning: Cannot modify header information - headers already sent" I havent even looked at the warning i just tried to fix the fatal error. Again i looked around the web and forums and php.net and thought maybe i need to set the value to "true" but it still got a fatal error. I looked on php.net and in there examples for dump_mem() and they had the nodes set_attribute create_element and append_child. Which confused me as that was what i used originally just following the google script and that got me the error right away "Fatal error to undefined method DOMDocument::create" Can anybody point out whats going wrong? This is my script that I am using <?php require('connect.php'); ?> <!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 content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>phpsqlajax_genxml.php</title> </head> <body> <?php // Start XML file, create parent node $doc = new DOMDocument('1.0'); $node = $doc->createElement('markers'); $parnode = $doc->appendChild($node); // Select all rows in markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die ('Invalid query: ' . mysql_error()); } header('Content-type: text/xml'); // Iterate through the rows, addind xml nodes for each while ($row = mysql_fetch_assoc($result)) { // Add to XML document node $node = $doc->createElement('marker'); $newnode = $parnode->appendChild($node); $newnode->setAttribute ('name', $row['name']); $newnode->setAttribute ('address', $row['address']); $newnode->setAttribute ('lat', $row['lat']); $newnode->setAttribute ('lng', $row['lng']); $newnode->setAttribute ('type', $row['type']); } $xmlfile = $doc->dump_mem(); echo $xmlfile; ?> </body> </html> And the google code is on the link in posted in the messge also but this is theres both of which fail for Fatal errors either on the dump_mem() or new DOMDocument respecitvaley : <?php require("phpsqlajax_dbinfo.php"); // Start XML file, create parent node $doc = domxml_new_doc("1.0"); $node = $doc->create_element("markers"); $parnode = $doc->append_child($node); // Opens a connection to a MySQL server $connection=mysql_connect (localhost, $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE $node = $doc->create_element("marker"); $newnode = $parnode->append_child($node); $newnode->set_attribute("name", $row['name']); $newnode->set_attribute("address", $row['address']); $newnode->set_attribute("lat", $row['lat']); $newnode->set_attribute("lng", $row['lng']); $newnode->set_attribute("type", $row['type']); } $xmlfile = $doc->dump_mem(); echo $xmlfile; ?> Thanks to anybody who can help me out If a class has a constructor but also has a static method, if I call the static method does the constructor run so that I can use an output from the constructor in my static method? --Kenoli I have two classes: ## Admin.php <?php class Admin { public function __construct() { include("Config.php"); } /** * deletes a client * @returns true or false */ function deleteClient($id) { return mysql_query("DELETE FROM usernames WHERE id = '$id'"); } } ?> ## Projects.php <?php class Projects { public function __construct() { include("Config.php"); $this->admin = $admin; $this->dataFolder = $dataFolder; } /** * Deletes a project * @returns true or false */ function deleteProject($id) { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder; $sql = mysql_query("SELECT * FROM projectData WHERE proj_id = '$id'"); while ($row = mysql_fetch_array($sql)) { $mainFile = $row['path']; $thumb = $row['thumbnail']; if ($thumb != 'null') { unlink($theDir . "/" . substr($thumb,13)); } unlink($theDir . "/" . substr($mainFile,13)); } $delete = mysql_query("DELETE FROM projectData WHERE proj_id = '$id'"); $getDir = mysql_query("SELECT proj_path FROM projects WHERE id = '$id'"); $res = mysql_fetch_array($getDir); rmdir($theDir . "/" . $res['proj_path']); return mysql_query("DELETE FROM projects WHERE id = '$id'"); } } ?> How can I call deleteProject() from within Admin.php?
My script has 3 classes (that are relevant to this discussion): DB, User and Validate. They are all in independent files and loaded automatically, when required, by an autoloader.
The error messages I am getting a Any pointers as to what I am doing wrong, or what I should be doing, would be most welcome. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=319682.0 I can call the following function successfully as a single php program // Acknowledge and clear the orders function ack($client, $merchant, $id) { $docs = array('string' => $id); $params = array('merchant' => $merchant, 'documentIdentifierArray' => $docs); $result = $client->call('postDocumentDownloadAck', $params); return $result; } with $result = ack($t, $merchant,'2779540483'); successful output [documentDownloadAckProcessingStatus] => _SUCCESSFUL_ [documentID] => 2779540483 I'm trying to figure out how to call this function as an object from another program. Trying the following gives error ***Call to a member function call() on a non-object*** function postDocumentDownloadAck($t, $merchant, $id) { $this->error = null; $docs = array('string' => $this->id); $params = array('merchant' => $this->merchant, 'documentIdentifierArray' => $docs); ** I've tried the following which does nothing $result = $this->soap->call('postDocumentDownloadAck', $params); ** I've tried the following - which gives error "Call to a member function call() on a non-object" $result = $this->t->soap->call('postDocumentDownloadAck', $params); if($this->soap->fault) { $this->error = $result; return false; } return $result; } *** calling program snippet for above function $merchant= array( "merchant"=> $merchantid, "merchantName" => $merchantname, "email"=> $login, "password"=> $password); $t = new AmazonMerchantAPI($merchantid, $merchantname, $login, $password); $documentlist= $t->GetAllPendingDocumentInfo('_GET_ORDERS_DATA_'); $docid = $documentlist['MerchantDocumentInfo'][$i]['documentID']; $docs = array('string' => $docid); $ackorders = $t->postDocumentDownloadAck($t, $merchant,$docs); Any ideas of what I'm doing wrong are greatly appreciated. Hello, I've been trying this for hours now, looking at different examples and trying to change them to work for me, but with no luck... This is what I am trying to do: I have a simple form with: - 1 input field, where I can enter a number - 1 Submit Button When I enter a number into the field and click submit, I want that number to be send to the php file that is in the ajax call, then the script will take that number and run a bunch of queries and then return a new number. I want that new number to be used to call the php script via ajax again, until no number is returned, or something else is returned like the word "done" or something like that, at which point is simply makes an alert or populated a div with a message... The point is, that depending on the number entered it could take up to an hour to complete ALL the queries, so I want the script that is called to only run a fixed amount of queries at a time and then return the number it is currently at (+1), so that it can continue with the next number when it is called again. I would like to use jquery, but could also be any other way, as long as I get this to work. I already have the php script completed that needs to be called by the ajax, it returns a single number when being called. Thank you, vb I know I'm posting this inside the PHP coding board but I'm curious on how most handle this situation. I have a page that uses php to retrieve data from my database and I want to have it place a | in between each of the returned data which it does but it still places one after the last returned row. I'm wondering if I should do this with jquery load and then have it place that character in between each of the data or if there's a way to do it with php or what? Any ideas? Code: [Select] <?php require ("../header.php"); ?> <div id="titlehistory" class="content"> <h1 class="pageheading">Title History</h1> <?php $titlesQuery =" SELECT titles.titleName, titles.shortName FROM titles WHERE titles.statusID = 1 ORDER BY titles.ID"; $titlesResult = mysqli_query($dbc,$titlesQuery); ?> <p><span class="minilinks"> <?php while ( $row = mysqli_fetch_array ( $titlesResult, MYSQLI_ASSOC ) ) { $fieldarray=array('titleName','shortName'); foreach ($fieldarray as $fieldlabel) { ${$fieldlabel} = $row[$fieldlabel]; } echo '<a href="/titlehistory/'.$shortName.'">'.$titleName.'</a> |'; } ?> </span></p> <p class="nohistory">Please select a title to view.</p> </div> <?php require ("../footer.php"); ?> I am trying to insert the current Date/Time into mysql database using the following code. I do not understand how $submitDate & $submitTime are to be set. Will this work as coded? Code: [Select] <?php class SubmitDateRecord { const DB_TABLE = 'timesheet'; const DB_FIELD_SUBMIT_TIME = 'submit_time'; private $submitDate; private $submitTime; public function setSubmitDate($submitDate) { $this->submitDate = $submitDate; } public function getSubmitDate() { return $this->submitDate; } public function setSubmitTime($submitTime) { $this->submitTime = $submitTime; } public function getSubmitTime() { return $this->submitTime; } public function addRecord() { $insertTable = "`".self::DB_TABLE."`"; $insertFields[] = "`".self::DB_FIELD_SUBMIT_TIME."`"; $insertValues[] = "'{$this->submitDate} {$this->submitTime}'"; $sqlBuilder = new SQLQBuilder(); $query = $sqlBuilder->simpleInsert($insertTable, $insertValues, $insertFields); $dbConnection = new DMLFunctions(); $result = $dbConnection->executeQuery($query); if ($result) { return true; } else { return false; } } private function _buildRecordObjects($result) { while ($row = mysql_fetch_array($result)) { $submitdateObj = new SubmitDateRecord(); $submitdateObj->setAttendanceId($row['attendance_id']); $submitdateObj->setEmployeeId($row['employee_id']); /* $row['submit_time'] comes in '0000-00-00 00:00:00' format. * We want date in '0000-00-00' format and time in '00:00' format. */ $tmpArr = explode(' ', $row['submit_time']); $submitdateObj->setSubmitDate($tmpArr[0]); $submitdateObj->setSubmitTime(substr($tmpArr[1], 0, 5)); // Omiting 'seconds' part is ok since it is always zero $submitdateObj->setStatus($row['status']); $submitdateArr[] = $submitdateObj; } return $submitdateArr; } } |