-
Posts
82 -
Joined
-
Last visited
Never
About lordzardeck
- Birthday 04/23/1992
Contact Methods
-
Website URL
http://rockhardyouth.com
Profile Information
-
Gender
Male
lordzardeck's Achievements

Member (2/5)
0
Reputation
-
Oh, okay. Thanks. I solved the problem though. I needed to call serialize on the object BEFORE placing it in the session variable, and then call unserialize when retrieving it.
-
My object is loaded into a session variable at the end of the script. The next time the script is ran, the object is loaded from the session variable. When it does, I get this error: Fatal error: attackSystem::startAttack() [<a href='attacksystem.startattack'>attacksystem.startattack</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "trainingDummy" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/bfwd/public_html/lordsarmy/handlers/attacksystem.php on line 46 What does this mean?
-
Ok, i figured it out. I took the json encoded text within php and did a regex search for "fn": and removed the quotes around the text eclosed to the right of "fn":. When the json was loaded and parsed, it loaded it as a function. Thanks anyways!
-
I was unable to use eval because the the json keys and values are surrounded by " ". My navigation is created in by the yui library. The format it needs to be in is this: [ {"text":"Home"}, {"text":"Catalog","submenu": {"id":"catalogSub","itemdata": [ {"text":"Catalog", onclick: {fn: somefunction}}, {"text":"Add Book", onclick: {fn: function(){dosomething();}}} ] } }, {"text":"Patrons"} ] I can create a javascript file that i can dynamically load and execute, but that would involve having to iterate throught the entire array, and involve a lot of extra work. If it comes to that I guess I'd have to, but I would really like a better way. Is there someway to convert a string to a function?
-
How would you return a javascript function withing JSON encoded in php. I want to build a js menu with an onclick feature built by php dynamically, and encoded in JSON. is this possible? If not, does anyone have a better suggestion?
-
Thanks! That fixed it. I had never heard of IN() before, so this is a great tool that i learned!
-
My goal in this query is to search for books and return ones with certain ids and words in a column. For example, I have a table of books with title and itemid columns. And i have 4 itemid values: 5, 67, 46, 12. I also want to only return the values of those books whose title contain "exploring". So if the table was this: 5 exploring world 67 hello world 46 exploring life 12 exploring earth 345 this is random 23 exploring this 1 bar I should return rows 1, 3, and 4. What can I do to get this? I tried: SELECT * FROM thetable WHERE itemid = 5 OR itemid = 67 OR itemid = 46 OR itemid =12 OR title LIKE '%exploring%' But that would bring up rows 1, 2, 3, 4, and 6. Any ideas?
-
For some reason I keep getting a result when there is no result to return. I know for sure no books are checked out to me, but it still returns a result. If i use num_rows, I get the result "1"; The code to check if books are due is this: function patronbooks($patronid,$overdue=""){ if($overdue=="yes"){ $sql = "SELECT * FROM circulation WHERE "; $patron_query = "SELECT * FROM circulation WHERE patronid = $patronid"; $patron_books = self::$db->query($patron_query); while($row=self::fetch_row($patron_books)){ $formatedDate = self::convertTimeToPHP($row[datedue]); if($formatedDate[year]==2008){ $sqlArray[] = $row; } } $numSql = count($sqlArray); $i=1; $and = 'OR '; if(is_array($sqlArray)){ foreach($sqlArray as $row){ if($i==$numSql){$and='';} $sql .= "circulationid = $row[circulationid] $and"; $i++; } } if($sql!="SELECT * FROM circulation WHERE "){$patron_books = self::$db->query($sql);} else{return;} }else{ $patron_query = "SELECT * FROM circulation WHERE patronid = $patronid"; $patron_books = self::$db->query($patron_query); } return $patron_books; } And the code that calls it is: $overdue = $_POST['overdue']; if($_POST['includebooks']){ $books = self::patronbooks($patron['patronid'],$overdue); $numbooksout = self::$db->num_rows($books); if(!$books && $overdue){print "No overdue books!"; return;} if(!$overdue){print "Not overdue!";} echo $books; if(!$books){print "Not books!";} if(!$books && !$overdue){print "No books checked out!"; return;} $msg = self::generateEmailMessage($books, $patron, $_POST['usrmsg']); }else{$msg = $_POST['usrmsg'];} Thanks in advance for any help you can give.
-
I really didn't know where to put this since it is ajax, javascript, and php. My problem is trying to generate a data table off some json code encoded with php: php code: <?php require_once('./classes/datahandler.php'); $data = new datahandler(); $data->set_data(); $query = $data->query("SELECT * FROM item WHERE title LIKE '%Creation%'"); $row=$data->fetch_row($query); $json = $row; print "{results:["; echo json_encode($json); print "]}"; ?> json result: {results:[{"0":"60","itemid":"60","1":"4538","accessionnum":"4538","2":"","author":"","3":"","illustrator":"","4":"Science of the Physical Creation: Quiz Key","title":"Science of the Physical Creation: Quiz Key","5":"Second","edition":"Second","6":"Pensacola, FL :","pubplace":"Pensacola, FL :","7":"ABeka;","publisher":"ABeka;","8":"c1996","pubdate":"c1996","9":"","series":"","10":"","seriesnum":"","11":"75","pages":"75","12":"paper","binding":"paper","13":"excellent","condition":"excellent","14":"2","formatid":"2","15":"2005-09-15 00:00:00","entrydate":"2005-09-15 00:00:00"}]} html code: <!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>YUI Tester</title> <!-- Individual YUI CSS files --> <link rel="stylesheet" type="text/css" href="build/reset-fonts-grids/reset-fonts-grids.css"> <link rel="stylesheet" type="text/css" href="build/base/base-min.css"> <link rel="stylesheet" type="text/css" href="build/assets/skins/sam/skin.css"> <!-- Individual YUI JS files --> <script type="text/javascript" src="build/utilities/utilities.js"></script> <script type="text/javascript" src="build/datasource/datasource-min.js"></script> <script type="text/javascript" src="build/autocomplete/autocomplete-min.js"></script> <script type="text/javascript" src="build/container/container-min.js"></script> <script type="text/javascript" src="build/menu/menu-min.js"></script> <script type="text/javascript" src="build/button/button-min.js"></script> <script type="text/javascript" src="build/calendar/calendar-min.js"></script> <script type="text/javascript" src="build/carousel/carousel-min.js"></script> <script type="text/javascript" src="build/json/json-min.js"></script> <script type="text/javascript" src="build/charts/charts-min.js"></script> <script type="text/javascript" src="build/slider/slider-min.js"></script> <script type="text/javascript" src="build/colorpicker/colorpicker-min.js"></script> <script type="text/javascript" src="build/cookie/cookie-min.js"></script> <script type="text/javascript" src="build/paginator/paginator-min.js"></script> <script type="text/javascript" src="build/datatable/datatable-min.js"></script> <script type="text/javascript" src="build/editor/editor-min.js"></script> <script type="text/javascript" src="build/history/history-min.js"></script> <script type="text/javascript" src="build/resize/resize-min.js"></script> <script type="text/javascript" src="build/imagecropper/imagecropper-min.js"></script> <script type="text/javascript" src="build/imageloader/imageloader-min.js"></script> <script type="text/javascript" src="build/selector/selector-min.js"></script> <script type="text/javascript" src="build/layout/layout-min.js"></script> <script type="text/javascript" src="build/stylesheet/stylesheet-min.js"></script> <script type="text/javascript" src="build/tabview/tabview-min.js"></script> <script type="text/javascript" src="build/treeview/treeview-min.js"></script> <script type="text/javascript" src="build/uploader/uploader.js"></script> </head> <body> <div id="yuidatatable1"></div> <script type="text/javascript"> // BeginWebWidget YUI_DataTable: yuidatatable1 (function() { var cn = document.body.className.toString(); if (cn.indexOf('yui-skin-sam') == -1) { document.body.className += " yui-skin-sam"; } })(); var inityuidatatable1 = function() { var columnDef_yuidatatable1 = [ {key:"title",label:"Title"} ]; this.parseNumberFromCurrency = function(sString) { return parseFloat(sString.substring(1)); }; this.DS_yuidatatable1 = new YAHOO.util.XHRDataSource("json.php"); this.DS_yuidatatable1.responseType = YAHOO.util.DataSource.TYPE_JSON; this.DS_yuidatatable1.responseSchema = { fields: [ {key:"title"} ] }; var yuidatatable1 = new YAHOO.widget.DataTable("yuidatatable1", columnDef_yuidatatable1, this.DS_yuidatatable1); }; // Create the YUI DataTable when the HTML document is usable. YAHOO.util.Event.onDOMReady(inityuidatatable1); // EndWebWidget YUI_DataTable: yuidatatable1 </script> </body> </html> I've tried just about everything i can find and think of, but I can not even get it to work. If I could just even see an example that works that is as simple as this, I would appreciate. I do most of my learning by seeing working scripts and determine how they work.
-
Yeah, I should think before I post.
-
But doesn't it use the same queries like "SELECT * FROM foo WHERE bar = foo?
-
Well in the end, it won't even be a chat app, really. It's going to be a game that would work like a chat app, and I would like a chat feature included. Isn't sql lite just like mysql but as a single file?
-
Yeah, i would rather it be in a mysql db but I have 1&1, so my hosting provider basically sucks. But hey, it's cheap, affordable, and it provides the best options for $5. But sql lite should be okay. Anyone have anyideas where I can read about making a chat app with php and ajax?
-
Well, any help at any time would be grateful. This is going to be a long and difficult project.
-
Okay, I understand that i must use a db like sql lite? Is there any place I can read up on this?