PHP - Function Errors
Hi,
I'm trying to output some details from my database, along with a BLOB image. At the moment I'm having some warnings and notices and I don't know how to solve them. Here's the warnings and notices: Notice: Undefined index: id in G:\xampp\htdocs\xampp\dsa\search_func.php on line 38 Notice: Undefined variable: terms in G:\xampp\htdocs\xampp\dsa\search_func.php on line 13 Warning: mysql_query() expects parameter 2 to be resource, object given in G:\xampp\htdocs\xampp\dsa\search_func.php on line 16 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in G:\xampp\htdocs\xampp\dsa\search_func.php on line 22 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 27 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 27 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 27 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 27 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 28 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 28 Notice: Trying to get property of non-object in G:\xampp\htdocs\xampp\dsa\search_func.php on line 28 Here's the function code: Code: [Select] <?php /* return the details of an employee parameter empno - employee number eg empHTML.php?empno=7521 This is very basic e.g no error checking */ function search($dbc, $id) { // define the query string $query = "SELECT * FROM stick, location, identification WHERE make LIKE '%$terms%' AND stick.sid = location.lid AND identification.stickID = stick.sid "; // execute the query and return a pointer to the resultant SQL relation $dbresult = mysql_query($query,$dbc); // return the result as a simple HTML table $output = Array(); // get each tuple in the table as an object $image = mysql_fetch_object($dbresult); // interpolate the required employee values -> is the equivalent of the java DOT notation $output[] = '<ul>'; $output[] = '<li> Type: '.$image->make .'<br />Size: '.$image->size .$image->type .'<br />Colour: '.$image->colour . '<br /> Street Missing in: ' .$image->street.'<br />Town missing in: '.$image->town .'<br />City missing in: '.$image->city.'</li>'; $output[] = '</ul>'; return join('',$output); } // connect $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // get the department name from the URL $id = $_REQUEST['id']; // print the table of employees for this department // put it ina div HTML element with an emp class to support CSS styling print search($dbc, $id); print "<img src='getPhoto.php?id=$id'/>"; // close the database mysql_close($dbc); Similar TutorialsPlease help me fix these errors in my function. Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 10 in Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in Code: [Select] function verify_user_fanned_company($uid, $cid) { $uid = (int)$uid; $sql = " SELECT `company_id` FROM `company_fans` WHERE `user_id` = {$uid} AND `company_id` = {$cid} "; $query = mysql_query($sql); $result = mysql_result($query, 0); $num = mysql_num_rows($result); if ($num === 1) { return true; } } Code: [Select] <?php $is_fanned = verify_user_fanned_company($user_info['uid'], $info["companyid"]); if ($is_fanned = true) { ?> do stuff <?php } ?> I know that the following lines of code can be used to prevent errors from being displayed: Code: [Select] <?php error_reporting(0); ini_set('display_errors', 0); ?> Is there a reason to use one over the other? Is it better to use both? I have this code that has Code: [Select] $this->BeginTransaction();all over it. These are in classes where no such function is defined, and they don't have parents either. It's driving my crazy trying to figure out why they are there, why there's not so much as a warning being given and what, if anything, is being called. Now I do have a Code: [Select] set_error_handler("amfErrorHandler");and in amfErrorHandler I have Code: [Select] if( error_reporting() != 0 && ($amfphpErrorLevel | $level) == $amfphpErrorLevel ) { throw new VerboseException($string, $level, $file, $line); } I don't remember what $amfphpErrorLevel is, except that it should only be ignoring things like E_STRICT. Also, no exception is being thrown. So what do I do w/this code? HI guys I have vreated a site and am now trying to validate the ip address i have created a function but am failing to get it to work i need to add the errors to add to the errors array but instead it keeps resetting and leaving me with the last error that is returned any help would be greatly appreciated im a newbie so if i can understand the concept behind whats happening it will be of great benefit Thanks Sean heres the code // Function validateIpaddress($address,$record,$errors) // { // if ($address !=="" or $address !=="ip_address") // { // Print_r($address); // echo "<br><br>"; // $fullstoppos = strpos(($address), "."); // echo "strpos = $fullstoppos"; // $fullstoppos2 = strpos(($address), ".", $fullstoppos+1); // echo "strpos2 = $fullstoppos2"; // $fullstoppos3 = strpos(($address), ".", $fullstoppos2+1); // echo "strpos3 = $fullstoppos3"; // } // if ($fullstoppos !==4 && $fullstoppos2 !==9 && $fullstoppos3 !==14) // { // $errors[] = "<br><font color='red'>Please correct the following.Or contact your client manager for assitance.<br>* $record is a required field.An ip address is a 16 digit numerical value. </font>"; // } // } $errors = validateIpaddres($_POST['destinationPoint'],A/AAAA record, $errors) How do I display the actual errors in IIS 7.5? If I miss a semicolon, I get: "HTTP Error 500.0 - Internal Server Error" absolutely useless. In prior versions, I could see the line and get to the PHP error. How do I display PHP errors? I've added: set_ini('display_errors', '1'); but it doesn't help. The code below returns the correct results, which are in this case are email addresses. After each displayed value there is a br eg. emai1@hotmail.com<br>email2@hotmail.com<br>email3@ etc. So the quesion is, can i change the below codeing to prevent this. I have tried changing $message .= "<br>". $row['email'] to $message .= "\n". $row['email'] but this results in; Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html $code = $_GET['postcode']; $message = $_GET['message']; $emailad = "email@hotmail.co.uk"; $shortcode = substr($code,0,2); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; while ($row = mysql_fetch_array( $result )) { $message .= "<br>". $row['email'] ; } echo "\n"; echo $message; mail( "$emailad", "Header","$message" ); echo "<br>" . "Thank you for using our mail form."; i get this when i tried to retrive a venue id so admin can edit them Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Warning: session_start() [FUNCTION.SESSION-START]: Cannot send session cache limiter - headers already sent Code: [Select] <?php include 'scripts/connect.php'; if(isset($_GET['vid'])){ $query = mysql_query("SELECT * FORM venue"); while ($row = mysql_fetch_array($query)){ $id = $row['id']; $venuename = $row['venuename']; $address = $row['address']; $phone = $row['phone']; $vemail = $row['vemail']; $state = $row['state']; $town = $row['town']; $zip = $row['zip']; $seats = $row['seats']; } } ?> <?php require "header.php"; ?> When I am trying to update a record in the database i get this error after I submit the form that is populated from the database. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc = 'SFR ANNOUNCES 3RD ANNUAL \"12 DAYS OF CHRISTMAS FOOD DRIVE\"', body = '<' at line 1 Does anyone know of a function that I can use to get all occurring PHP errors during script execution into a string. Also, does anyone know what's wrong with php.net? It keeps saying service is down. i m facing this 2 errors in the below script
Notice: Undefined index: media in D:\server\website\htdocs\wefondyou\themes\grape\layout\story\content.phtml on line 107 Warning: Invalid argument supplied for foreach() in D:\server\website\htdocs\wefondyou\themes\grape\layout\story\content.phtml on line 107 I had tried add isset and is_array to line, the errors gone away, but image also gone away. any ideas?? <div id="story_<?php echo $sk['story']['id']; ?>" class="story-wrapper story_<?php echo $sk['story']['id']; ?>" data-story-id="<?php echo $sk['story']['id']; ?>"> <div class="publisher-wrapper"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="48px" align="left" valign="top"> <a href="<?php echo $sk['story']['publisher']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['publisher']['username']; ?>"> <img class="avatar" src="<?php echo $sk['story']['publisher']['thumbnail_url']; ?>" width="40px" height="40px" alt="<?php echo $sk['story']['publisher']['name']; ?>"> </a> </td> <td align="left" valign="top"> <a class="name" href="<?php echo $sk['story']['publisher']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['publisher']['username']; ?>"> <?php echo substr($sk['story']['publisher']['name'], 0, 35); ?> </a> <?php if ($sk['story']['recipient_exists'] == true) { ?> <i class="icon-arrow-right recipient-indicator-icon"></i> <a class="name" href="<?php echo $sk['story']['recipient']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['recipient']['username']; ?>"> <?php echo substr($sk['story']['recipient']['name'], 0, 35); ?> </a> <?php } echo $sk['story']['activity_text']; ?> <div class="other-data"> <span class="time-wrapper ajax-time" title="<?php echo date('c', $sk['story']['time']); ?>"> <?php echo date('c', $sk['story']['time']); ?> </span> <?php if ($sk['story']['location_exists'] == true) { ?> <abbr class="space3">·</abbr> <span class="location-wrapper" title="<?php echo $sk['story']['location']['name']; ?>"> <i class="icon-map-marker"></i> <?php echo $sk['story']['location']['name']; ?> </span> <?php } ?> </div> </td> </tr> </table> <?php if ($sk['logged'] == true) { ?> <div class="setting-buttons"> <?php if ($sk['story']['admin'] == true) { ?> <span class="remove-btn cursor-hand" title="<?php echo $lang['remove']; ?>" onclick="SK_deletePostWindow(<?php echo $sk['story']['id']; ?>);"> <i class="icon-remove progress-icon"></i> </span> <?php } elseif (!SK_isPostReported($sk['story']['id'])) { ?> <span class="report-btn cursor-hand" title="<?php echo $lang['report']; ?>" onclick="SK_reportPost(<?php echo $sk['story']['id']; ?>);"> <i class="icon-flag progress-icon"></i> </span> <?php } ?> </div> <?php } ?> </div> <?php if ($sk['logged'] == true) { ?> <div class="options-wrapper"> <?php echo SK_getPostLikeButton($sk['story']['id']); ?> <abbr class="space6">·</abbr> <?php echo SK_getPostShareButton($sk['story']['id']); ?> <abbr class="space6">·</abbr> <?php echo SK_getPostFollowButton($sk['story']['id']); ?> </div> <?php } if (!empty($sk['story']['text'])) { ?> <div class="text-wrapper"> <?php echo $sk['story']['text']; ?> </div> <?php } if ($sk['story']['media_exists'] == true) { // If it is photos if ($sk['story']['media_type'] == "photos") { ?> <div class="photos-wrapper"> <?php $photo_class = 'width-' . $sk['story']['media_num']; if ($sk['story']['media_num'] >= 3) { $photo_class = 'width-3'; } LINE HERE 107 -----> foreach ($sk['story']['media'] as $photo) { ?> <a href="javascript:void(0);"> <img class="<?php echo $photo_class; ?>" src="<?php echo $photo['url']; ?>" alt="Photo" onclick="javascript:SK_openLightbox(<?php echo $photo['post_id']; ?>);"> </a> <?php } ?> </div> <?php } elseif ($sk['story']['media_type'] == "soundcloud") { ?> <div class="soundcloud-wrapper" align="center"> <iframe frameborder="0" src="https://w.soundcloud.com/player/?url=<?php echo $sk['story']['media']['url']; ?>&color=f07b22" width="100%"></iframe> </div> <?php } elseif ($sk['story']['media_type'] == "youtube") { ?> <div class="youtube-wrapper" align="center"> <iframe src="https://www.youtube.com/embed/<?php echo $sk['story']['media']['id']; ?>?ap=%2526fmt%3D18&disablekb=1&rel=0" width="100%" height="300px" frameborder="0" allowfullscreen></iframe> </div> <?php } } elseif ($sk['story']['location_exists'] == true) { ?> <div class="google-map-viewer-wrapper" align="center"> <img src="http://maps.googleapis.com/maps/api/staticmap?center=<?php echo $sk['story']['location']['name']; ?>&zoom=13&size=600x300&maptype=roadmap&markers=color:red%7C<?php echo $sk['story']['location']['name']; ?>" width="100%" alt="<?php echo $sk['story']['location']['name']; ?>"> </div> <?php } ?> <div class="activity-wrapper"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="middle"> <span class="story-like-activity"> <?php echo SK_getPostLikeActivityButton($sk['story']['id']); ?> </span> <abbr class="space6">·</abbr> <span class="story-comment-activity"> <?php echo SK_getPostCommentActivityButton($sk['story']['id']); ?> </span> <abbr class="space6">·</abbr> <span class="story-share-activity"> <?php echo SK_getPostShareActivityButton($sk['story']['id']); ?> </span> </td> <td align="right" valign="middle"> <?php if ($sk['story']['via_type'] == "like") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo $sk['story']['via']['name']; ?> </a> <?php echo $lang['likes_this_label']; ?> <?php } elseif ($sk['story']['via_type'] == "share") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo $sk['story']['via']['name']; ?> </a> <?php echo $lang['shared_this_label']; ?> <?php } elseif ($sk['story']['via_type'] == "tag") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo substr($sk['story']['via']['name'], 0, 15); ?> </a> <?php echo $lang['tagged_on_this_label']; ?> <?php } ?> </td> </tr> </table> </div> <div class="comments-container hidden"> <?php if ($sk['story']['view_all_comments'] == true) { ?> <div class="view-more-wrapper" align="center" onclick="SK_loadAllComments(<?php echo $sk['story']['id']; ?>);"> <i class="icon-lightbulb progress-icon hide"></i> <?php echo $lang['view_all_comments_label']; ?> </div> <?php } ?> <div class="comments-wrapper"> <?php echo $sk['story']['comments']; ?> </div> <?php echo $sk['story']['comment']['publisher_box']; ?> </div> </div> Hi I'm in need of help with some errors that the admin page of my cms is spitting out, I'm very new to php but I'm great understanding directions so any help that anyone can provide will be greatly appreciated.
These are the errors being displayed:
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mysite/public_html/includes/joomla.php on line 437 im getting following errors:
Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: property line 6 and xsl:for-each in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 25 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: for-each line 5 and property in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 26 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: xsltParseStylesheetProcess : empty stylesheet in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]: No stylesheet associated to this object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 16 Fatal error: Call to a member function saveXML() on a non-object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 18 the xslt file is as following: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19...XSL/Transform"> <xsl:output method="xml" indent="yes"/> Does anyone know what would cause this error: Notice: Undefined index: file in C:\Inetpub\wwwroot\Upload\uploader3.php on line 2 No file specified with these files for uploading images: uploader.htm <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and, uploader.php <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>"><img src="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>" height="200"></a> </body> </html> Thanks! Hello. I am at beginning with php and now trying to make an ecommerce website. I know it's a bit stupid but it works until now. This site work perfect on localhost using xampp but then I transfered it to webhost, I get a lot of errors. Hi, I am getting a couple of errors when running my php script PHP Error: 8: Undefined property: ***********::$xmltypehandlers, in ************* ←[32m[xmlServ:0] ←[33;1m[10:31:15]←[1m ←[37mStarted CPSM, version 0.04, Login Se rver communication mode: database ←[00m Connected to MySQL server localhost username *** PHP Error: 8: Use of undefined constant MSG_EOR - assumed 'MSG_EOR', in*******\ClientBase.php at 33! PHP Error: 2: socket_send() expects parameter 4 to be long, string given, in ******\ClientBase.php at 43! ←[32m[xmlServ:1] ←[33;1m[10:31:46]←[1m ←[37mClient created, ID:1, Socket ID: 0, rndK: ?NeR9X3lTWw←[00m PHP Error: 8: Use of undefined constant MSG_EOR - assumed 'MSG_EOR', in *********\ClientBase.php at 33! PHP Error: 2: socket_send() expects parameter 4 to be long, string given, in *********\ClientBase.php at 43! ←[32m[xmlServ:1] ←[33;1m[10:31:46] ←[35;1mMalformed packet <policy-file-request/ > sent by 0←[00m Since most of the errors originate in ClientBase.php Here is that File: Code: [Select] <?php class ClientBase{ static $num = 0; static $count = 0; public $properties = array(); public $p = null; public $sock; public $parent; public $room; public $uniqueid = 0; public $inGame = false; public $xpos = 0; public $ypos = 0; public $clientID = 0; public $name = ""; function __construct($sock, $server, $clientid){ self::$num++; self::$count++; $this->parent =& $server; $this->uniqueid = self::$count; $this->sock = $sock; $this->p =& $this->properties;//p and properties are for temporary properties. $this->p['rndK'] = $this->makeRndK(); $this->clientID = $clientid; } /*function __destruct(){ self::$num--; @socket_close($this->sock); }*/ function write($data, $flags = MSG_EOR){ $data .= chr(0); $sendLen = strlen($data); $w = array($this->sock); $a = null; $b = null; $res = @socket_select($a, $w, $b, 0.15); if($res === false){ return $this->parent->removeClient($this->clientid); } $len = @socket_send($this->sock, $data, $sendLen, $flags); //$times = 5; /*while($len === false && $len < $sendLen){ if($len === false){ $ltr = 0; } else $ltr = $len; $data = substr($data, $ltr); $sendLen = strlen($data); $len = @socket_send($this->sock, $data, $sendLen, $flags); usleep(2000); $times--; if($times < 0) break; }*/ return $len ? true : false; } function makeRndK(){ $c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxwz0123456789?~"; $l = rand(6,14); $s = ""; for(;$l > 0;$l--) $s .= $c{rand(0,strlen($c) - 1)}; return $s; } function buildClientString($type = "raw", $s = "%"){ if($type == "xml"){ return $this->buildXmlPlayer(); } return $this->buildRawPlayer($s); } function getSortedProperties(){ } function buildRawPlayer($s){ return implode($this->getSortedProperties(), $s); } function getSocket(){ return $this->sock; } } ?> Please Help, Thanks. If the first error means a lot I will post some of that file too. Hi everyone I am pretty new to php but have been playing around with it for awhile. I have been trying to include a offline script from codecanyon located (http://codecanyon.net/item/web-construct/61643). The problem I am having is when I try to include the file as per the scripts instruction (<?php include("offline.php");?>) I get all sorts of errors on mysite (please see below for one error). I read his discussion section were one person is having the same problem I am having the script developers answers was (Place the webconstruct include after the session_start() line). I have tried that or think I did it right but still getting the same errors as before. Can someone please help me in getting this script installed? I will copy the session code below and if someone can point me to the right direction in how to resolve this issue I would be thankful. (error) Notice: Use of undefined constant (my session code) <? if ( isset($_SESSION['url']) && $_SESSION['url'] != $SITE_URL ) { session_destroy(); ?> <script language="javascript">window.location.href="index.php";</script> Thanks in advance for anyone's help! I'm not sure why but I'm getting the following errors inside of FireBug after my form submits. <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/xtremer/public_html/efedmanager/processes/bookings.php</b> on line <b>49</b><br /> <br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/xtremer/public_html/efedmanager/processes/bookings.php</b> on line <b>68</b><br /> <br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/xtremer/public_html/efedmanager/processes/bookings.php</b> on line <b>82</b><br /> Code: [Select] <?php error_reporting( E_ALL ); // Include the database page require ('../inc/dbconfig.php'); $eventItems = json_decode( $_POST[ 'event_items' ], true ); $event_id = (int)$_POST['event_id']; for( $i = 0; $i < sizeof( $eventItems ); $i++ ) { $eventItem = $eventItems[ $i ]; $segment_type = $eventItem['segment_type']; if ($eventItem[ 'segment_type' ] === 'Introduction' ) { $introduction_preview = $eventItem['introduction_preview']; $query = "INSERT INTO `event_segments` (event_id, segment_type, introduction_preview) VALUES ('".$event_id."', '".$segment_type."','".$introduction_preview."')"; mysqli_query($dbc, $query); } if ($eventItem[ 'segment_type' ] == "Match") { $segment_writer_id = $eventItem['segment_writer_id']; $match_number = $eventItem['match_number']; $match_type_id = $eventItem['match_type_id']; $segment_title = $eventItem['segment_title']; $titles_id_list = $eventItem['titles_id_list']; $stipulations_id_list = $eventItem['stipulations_id_list']; $characters_id_list = $eventItem['characters_id_list']; $segment_preview = $eventItem['segment_preview']; $query = "INSERT INTO `event_segments` (event_id, segment_writer_id, segment_type, match_number, segment_title, segment_preview, is_submitted_yes_or_no_id) VALUES ('".$event_id."', '".$segment_writer_id."', '".$segment_type."' ,'".$match_number."','".$segment_title."','".$segment_preview."',2)"; mysqli_query($dbc, $query); $event_segment_id = mysqli_insert_id($dbc); foreach ($characters_id_list AS $character_id) { $query2 = "INSERT INTO `event_match_characters` (event_segment_id, character_id) VALUES ('".$event_segment_id."', '".$character_id."')"; } mysqli_query($dbc, $query); $query = "INSERT `event_match_match_types` (event_segment_id, match_type_id) VALUES ('".$event_segment_id."', '".$match_type_id."')"; mysqli_query($dbc, $query); if ($stipulations_id_list != "0") { foreach ($stipulations_id_list AS $stipulation_id) { $query = "INSERT `event_match_stipulations` (event_segment_id, match_type_id) VALUES ('".$event_segment_id."', '".$stipulation_id."')"; mysqli_query($dbc, $query); } } if ($titles_id_list != "0") { foreach ($titles_id_list AS $title_id) { $query = "INSERT `event_match_titles` (event_segment_id, title_id) VALUES ('".$event_segment_id."', '".$title_id."')"; mysqli_query($dbc, $query); } } } if ($eventItem[ 'segment_type' ] == "Segment") { $segment_writer_id = $eventItem['segment_writer_id']; $segment_number = $eventItem['segment_number']; $query = "INSERT INTO `event_segments` (event_id, segment_writer_id, segment_type, segment_number, sort_order_preview, is_submitted_yes_or_no_id) VALUES ('".$event_id."', '".$segment_writer_id."', '".$segment_type."' ,'".$segment_number."','".$sort_order_number."',2)"; mysqli_query($dbc, $query); } if ($eventItem[ 'segment_type' ] == "Conclusion") { $conclusion_preview = $eventItem['conclusion_preview']; $query = "INSERT INTO `event_segments` (event_id, segment_type, conclusion_preview) VALUES ('".$event_id."', '".$segment_type."','".$conclusion_preview."')"; mysqli_query($dbc, $query); } $query = "UPDATE `events` SET `event_status_id` = 2 WHERE id = '".$event_id."' LIMIT 1"; mysqli_query($dbc, $query); } ?> Hi, I'm Chris, first time here, I usually post on stackoverflow but I think that this is a little bit more complex than usual.
I believe I really need a PHP expert to solve this issue. We have an application which is crawling the web. There's 2 main PHP scripts that are doing the work, using using proc_open, and exec() and running over a circular reference. Both scripts that compose the main structure are saving all and every single error on a custom error log, defined this way:
//error_log @ini_set('error_reporting', -1); @ini_set('log_errors','On'); @ini_set('display_errors','On'); @ini_set('error_log','/var/www/vhosts/xxx/xxx/resonance/such_a_mess'); The problem is simple, after running for some hours or days, the application stops crawling. And there's no error information at all on the error_logs that could explain the problem or the reason why it stopped. I've been trying to get more details using Newrelic and XHProf, no luck.- There's no HTTP server involved on the execution of the scripts as they are being executed like I mentioned, using exec() and proc_open: exec("sh -c \"$cmd | logger\" > /dev/null &"); It has been around 3 months on the same situation... and to be honest the only thing I want at this point is to see a fatal error on the logs, to understand what's going on... my site regularly encounter errors, and I'm not sure what's going on, because I did not edit anything "
" Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request. " I use webhosting for 2 sites, wordpress, Folder tree as follows : home/mysite.com , home/mysite.com/mysite2/ , and I use 2 different domain for 2 sites. when buying a new server and upload the data, I have changed their position, and the error occurred on. |