maddogandnoriko
Members-
Posts
63 -
Joined
-
Last visited
Never
Everything posted by maddogandnoriko
-
Can someone tell me why this is generating and unexpected tvariable error? this->languages[0] is 'en' and id is set. This function is in a class. I wanted the language to be set to languages[0] if no value was passed. And the function works if I remove:$language=$this->languages[0]. Thank you maddogandnoriko function getXML($ID,$language=$this->languages[0]){ $url= $this->URL .API.'/all/'.$language.'.xml'; $this->xml = simplexml_load_file($url); }
-
[SOLVED] getting all variables
maddogandnoriko replied to maddogandnoriko's topic in PHP Coding Help
Thank you. I can't believe I haven't discovered this yet! That is a ton of info. Thanks maddogandnoriko -
Is there way to "print" out every available variable available to the script? More specifically, every variable set by me in the script? I am rewritting a page and refining it and would like to eliminate anything unneeded. Thanks you for the advice, maddogandnoriko
-
I am not sure if this is the proper place or correct forum etiquette, but here goes: Thank you to everyone that has helped not just me but anyone stuck or lost. Without your help, who knows where we would be. And so far everyone is so patient and helpful and QUICK, even with questions that seem stupid. Even stupid questions are learning experiences. THANK YOU!!!!!! maddogandnoriko
-
[SOLVED] when create new object
maddogandnoriko replied to maddogandnoriko's topic in PHP Coding Help
Thank you for the advice. Sounds good to me. Less objects seemed better to me but wasn't sure. maddogandnoriko -
I created a class to handle retrieving and processing data from a public DB, it has 20 functions, and a Connector class to connect to my db. All works pretty well. In the public DB class I created one connector object to be used by all the functions. I now wonder if each function should create a new connector? I have a feeling this may be a real complex question and may depend on my code and such....so I guess I am looking for 'In general' answers.....I have included the connector class below. Thanks maddogandnoriko <?php //////////////////////////////////////////////////////////////////////////////////////// // Class: DbConnector // Purpose: Connect to a database, MySQL version /////////////////////////////////////////////////////////////////////////////////////// require_once 'SystemComponent.php'; class DbConnector extends SystemComponent { var $theQuery; var $link; //*** Function: DbConnector, Purpose: Connect to the database *** function DbConnector(){ // Load settings from parent class $settings = SystemComponent::getSettings(); // Get the main settings from the array we just loaded $host = $settings['dbhost']; $db = $settings['dbname']; $user = $settings['dbusername']; $pass = $settings['dbpassword']; // Connect to the database $this->link = mysql_connect($host, $user, $pass); mysql_select_db($db); register_shutdown_function(array(&$this, 'close')); } //*** Function: query, Purpose: Execute a database query *** function query($query) { $this->theQuery = $query; return mysql_query($query, $this->link); } //*** Function: getQuery, Purpose: Returns the last database query, for debugging *** function getQuery() { return $this->theQuery; } //*** Function: getNumRows, Purpose: Return row count, MySQL version *** function getNumRows($result){ return mysql_num_rows($result); } //*** Function: fetchArray, Purpose: Get array of query results *** function fetchArray($result) { return mysql_fetch_array($result, MYSQL_ASSOC); } //*** Function: close, Purpose: Close the connection *** function close() { mysql_close($this->link); } }
-
excellent. Thank you. maddogandnoriko
-
I am loading a fairly large xml file (400-500k) into a simple xml object. When I am done using it do I need to "close" the xml object or unset it or anything? maddogandnoriko
-
I narrowed my problem down to an xml class I was using to be php4 compatible. I did not write the class so I am just going to ditch it and use the full potential of php5. Thank you all for helping me locate the problem. maddogandnoriko
-
I didn't want to just add more memory...that seems like more of a bandaid than a fix. It doesn't seem to me like it should take that much memory. maddogandnoriko
-
I was using a simplexml class that was created for ph pre5.xx. I have decided to abandon that and use php5. For loading a large(ish) file like 400-500k, which would take up less memory, simplexml or xml_parser? I really can't post the code it is spread across a number of includes and classes. I am trying to narrow it down a bit so I can post the offending code. maddogandnoriko
-
would you expect a 450k file take 8M though? Thank you for the memory functions. I am trying now to pinpoint the problem. maddogandnoriko
-
My script is importing a 400-500k xml file and putting it into an array. I am getting an error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 40 bytes) in /Applications/MAMP/htdocs/VideoMainframe/includes/classes/simplexml.php on line 282 I know what it means I think, out of 8megs of memory. Something is wrong. Is there a way to determine how much memory a script is using? Like echo or print the value so i can try to see where the memory spikes up? Also...any hints on tracking this error would be a great help. I will look for infinite loops, but a quick look revealed none. Is there a way to print ALL vars available to the script? Maybe I can spot it that way... Oh yeah I changed all of my requires to require_once too. There is too much code in too many files to post yet.....until I can narrow the problem down. thank you very very much, maddogandnoriko
-
Lonewolf, excellent suggestion. Yesideez , I know lightbox and use a variation of it, I do not need a full blown gallery. Thanks for the suggestion anyhow. Thank you
-
I have an array of images(paths) and I want to display them in a gallery manner, but no gallery function. Just a grid of images. How can this be accomplished dynamically according the screens width? For example a small screen will display them 3 pictures across and a large screen will display 4 or 5 across? Thank you for your help and suggestions, maddogandnoriko
-
[SOLVED] replace space character problem
maddogandnoriko replied to maddogandnoriko's topic in PHP Coding Help
I took a closer look at the html and it is not space characters, it is return characters. My apologies. And thank you for helping me find the problem. Todd -
[SOLVED] replace space character problem
maddogandnoriko replied to maddogandnoriko's topic in PHP Coding Help
Ken, I am new to regex and have a problem getting past the space characters. Ultimately I am trying to put a regex together to extract the good links and bad links into separate arrays, where the links vary in number. todd -
[SOLVED] replace space character problem
maddogandnoriko replied to maddogandnoriko's topic in PHP Coding Help
did just now, still no luck. Sounded like a good solution to me though. Todd -
I am trying to replace space characters returned in short an html string with nothing to help me build a regex statement. I tried this with no joy: $thtml = str_ireplace(' ','',$thtml); and here is the string: {"links_existed":{1958300:{"id_str":"1958300", "filename":"bw.0102.part1.rar", "size":"104857600", "download_url":"http://depositfiles.com/files/1958300"}, 1958303:{"id_str":"1958303", "filename":"bw.0102.part2.rar", "size":"104857600", "download_url":"http://depositfiles.com/files/1958303"}, "ve4w82ro7":{"id_str":"ve4w82ro7", "filename":"DFManagerSetup.exe", "size":"1063760", "download_url":"http://depositfiles.com/files/ve4w82ro7"}}, "links_deleted":{1493393:{"id_str":"1493393", "filename":"Cap.iKA.part1.rar", "size":"104750000", "download_url":"http://depositfiles.com/files/1493393"}}}
-
Ok....this is a very newbie question. How does the extended class know what instance of the parent class to get the variable from?
-
I wanted to clarify a little. I tried parent:html and $this->html. Both seemed not to work. todd
-
I am fairly new to oop and am creating a class to extend a class. How do I use a parent classes variable? here is a basic structure I have. class html_grabber{ var html; SOME FUNCTIONS.... } class link_checker{ var links; function get_links(){ ...pull links from parent's $html } I hope that is enough info.... Thank you, todd
-
I hope someone can answer this. Sometimes when executing a script ALOT of times, at a certain point my browser stops executing new versions of the script and keeps executing an older version. I had thought that shift reload fixed that but apparently not.....any insights? todd
-
[SOLVED] cut x number off array
maddogandnoriko replied to maddogandnoriko's topic in PHP Coding Help
Thanks Guys! Any of those solutions will work, have to see what fits best. Thank you very much! -
I have an array with say 100 elements. I need to execute code on it for the first 50 elements and then cut them off and execute the code on the last 50. I think what I need is something like and array_shift but for 50 elements. Thank you for your help. todd