MyUPB.com Discussion forums
You are not logged in. Please Register or Login.

Announcements

This project is not completely dead. I've just started work on localisation.
Please email me at clark@NOSPAMmyupb.com once you've registered so I can activate your account (remove "NOSPAM" from the email address)
~~~~ Clark


If you're getting a "Deprecated" error message, follow the instructions here

URGENT Security Patch for ≤ v2.2.6
A security hole has been discovered, follow the instructions and download the patch at the topic page.
Did the patch break your search page? Search Patch

Download myUPB
Version 2.2.7 Released - 24th December 2010


Posted: Feb 12, 2007 11:05:46 pm
Clark



Currently I have to use setFP at the beginning of each function after using global $link to set file pointers for the database tables.

Is there a way I can create a sort of global variable for each FP so I can just set them once at the beginning of the file and then just include the variables after the global $link

It would tidy up the code a bit and save some gnashing of teeth trying to work out why it's not working and then finding it's a FP problem.
myUPB Developer

Posted: Feb 12, 2007 11:57:29 pm
Rebles



well you could globalize a tdb resource, with those filepointers already defined, or you could create another function "setTextDBFps(&$db)" which takes a tdb resource as it's only argument and runs the setFp() commands there.

As far as debugging, any TextDB function, that needs an fp in it's arguemtns, that you call will check to make sure you set that fp, otherwise it will generate an error.  Depending how you setup TextDB to handle errors, it will either print it out or trigger an error.  So you might want to check your error_report() settings.
--Jerroyd Moore
Bachelors of Science, Computer Science 2011
Jack Baskin School of Engineering
University of California, Santa Cruz

Posted: Feb 13, 2007 2:32:49 am
Pilot



just pass your textdb class variable by reference to all your functions like:

$tdb = new tdb(directory, textdb);
$tdb->setFp("blah", "mytable");

function whatever($someVar, &$tdb) {
  $myQuery = $tdb->query("blah", "name='bob'");
}


by doing this, you could even set new file pointers in each of your functions and they would be accessable outside of your functions (as long as the function had been run first)
Tim Hoeppner

UPB Programmer
B. Sc. in Electrical Engineering

Powered by myUPB v2.2.6  ·   © PHP Outburst 2002 - 2013

Creative Commons License