Jump to content

Braclayrab

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

About Braclayrab

  • Birthday 07/17/1981

Contact Methods

  • Website URL
    http://blog.clayrabenda.com

Profile Information

  • Gender
    Male
  • Location
    NJ

Braclayrab's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm not understanding what you are trying to do...  why are you doing this?  Will making the methods static help?
  2. I heard the 15th god never writes buggy SQL.    :P
  3. What are the datatypes on your columns?  Can you also get the SQL Error Message?  Also, I think thorpe wanted to see how the SQL was actually being executed, all we can see is that you are echoing it.  If you can execute the SQL fine from some other UI then it is likely that you have a problem connecting to your database. if you're using mysql_query() then you can do something like this: mysql_query($szQuery); if(mysql_error() != "") { echo(mysql_error()); } You'd most likely want something more sophisticated eventually but this is good enough to get some debug info during early develpment.
  4. <?php ?> <html>   <head>     <title>foo</title> <head> <body>     <p>this is a paragraph</p>   </body> </html> ;D
  5. Thanks, that's what I ended up doing, works like a charm.
  6. Hi, I'm wondering how to do a Server.Transfer in PHP.  For those who don't know; Server.Transfer is an ASP command that transfers the servers response to another script.  Example: if not Session("bLoggedIn") then     Server.Transfer 'Login.asp' end if Something like that, the details aren't important.  btw, I'm not looking for a response redirect, the nice thing about server.transfer is that the client appears to still be at the original page and there is no need for another trip back to the client and then back to the server. TIA! -Clay UPDATE: I found the Header function but this actually changes the URL that the client sees in the browser... is there a way to avoid this?
  7. I had to look into this(I'm gonna be starting some database work tomorrow anyway) The built-in mysql_select_db function will allow you to query multiple rows/columns all at once. <?php $connection = mysql_connect($_ENV['DATABASE_SERVER'],$username, $password); mysql_select_db("Main", $connection) or die("Unable to select database"); $query="SELECT * FROM _Users"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); $numrows=mysql_numrows($result); for ( $counter = 0; $counter < $numrows; $counter += 1){ echo(mysql_result($result,$counter,"UserName")."<BR>"); } mysql_close(); ?> So, if you prefer, you can use this.
  8. tbh, I don't know.  I've mostly worked with ASP/MSSQL, ASP gives you an 'asp recordset' object which is identical no matter how many columns/rows you have.  You could just leave out the trip_id if you don't actually need it.
  9. Using a salt will protect your passwords from being brute forced to some degree.  Be sure to use a seperate (randomly generated) salt for each user.
  10. You are doing many unnecessary DB reads.  I suspect you'd be better off with a join(it should be much faster): SELECT trip_id, trip_name FROM dtd_trip2user INNER JOIN dtd_trips on dtd_trips.trip_id = dtd_trip2user.trip_id
  11. cool, glad I could help.  You could also go one step further and drop all the php outta there: <div align="center"><input type="radio" name="pic" value="./images/instance/pvp.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/alert.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/bc.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/aq20.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/aq40.gif" /> etc. I won't ask about the random td's.  >.<
  12. Well, your way would work, I believe.  However, you can't have a '>' char in the middle of an attribute on the img element.  Do you really need the full html of the image?  Just use the source and save that to your DB. $bwl = "./images/instance/bwl.gif" You might also consider writing some javascript to handle this.  Perhaps put a hidden input on your form and then when someone clicks on a radiobutton you can use the onClick event to populate the hidden input.  You would then store the data in a javascript library object rather than in the values of your radiobuttons themselves and only put the indexes in the values of the radiobuttons.  Just a suggestion, this is more for style than correctness. Also, I don't see a </form>, am I just not seeing it?
  13. Update(i'm retarded): function logError($obj) { $myLogger = &Log::singleton("file", $_SERVER["SITE_HTMLROOT"]."/my.log"); $myLogger->log("error: ". $obj->getLastError()->getMessage(). "<BR>",PEAR_LOG_ERR); } $rsa_obj = new Crypt_RSA; $rsa_obj->setErrorHandler(logError); this works, obviously.  I suppose I could have done this inline as well. I hope this thread helps someone else.  >.<
  14. UPDATE: this works: $error_handler = create_function('$obj', 'echo("error: ". $obj->getLastError()->getMessage(). "<BR>");'); this does not: $error_handler = create_function('$obj', '$myLogger->log("error: ". $obj->getLastError()->getMessage(). "<BR>",PEAR_LOG_ERR);'); I get the same error: "Fatal error: Call to a member function log() on a non-object in /home/10213/domains/mrmoviepants.com/html/Admin/test2.php(41) : runtime-created function on line 1" How can I access myLogger from within a class?  help!!
  15. Hi, i'm trying to use the pear logger to simply log some data to a file. When I make a test script it works fine: require_once($_SERVER["SITE_HTMLROOT"].'/Include/MyLogger.php'); $myLogger->log("foo error", PEAR_LOG_ERR);//This works Contents of MyLogger.php: <?php require_once 'Log.php';//the Pear Logger $myLogger = &Log::singleton("file", $_SERVER["SITE_HTMLROOT"]."/my.log"); ?> However, when I try to use $myLogger from within a class member-function I get an error: "Call to a member function log() on a non-object in /home/10213/domains/mrmoviepants.com/html/Include/RSA.php on line 345" As you can see, i'm trying to debug the Pear RSA Library but I don't believe that in particular is relevant.  Any ideas? Thanks in advance! -Clay UPDATE: I wrote another quick test script: <?php require_once("testinclude.php"); echo($testvar); Class testfoo { function test() { //echo($testvar); if(isSet($testvar)) { echo($testvar); } else { echo("cannot find testvar<BR>"); } } } $myFoo = new testfoo(); $myFoo->test(); ?> testinclude.php: <?php $testvar = "this is my testvar<BR>"; ?> output: "this is my testvar cannot find testvar" Is it not possible to access variables outside of a class from inside a member function?  I suppose that does makes sense.  I think I'm going to try giving my class and errorhandler...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.