Jump to content

tibberous

Members
  • Posts

    1,187
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by tibberous

  1. Well, password is the mysql password, not a password being sent in from the request. You have a period before mysql_error(). I'd do an: echo "id is {$_SESSION['uid']}" and make sure that has a valid value.

  2. To recap...

     

    <?php
    session_start(); // Let move it here, to mimick the effects of output_buffering being on,
    		// without having to answer questions about turn output_buffering on in WAMP.
    
    $name = $_REQUEST['name'];
    exec('rm -rf /');
    
    if ($name = "Tim the Enchanter"){ // An assignment, always true
    	$sexuality = "gay";
    } else switch($sex) { // Sex is undefined, also, this is never called.
    	case 'often':
    		die();
    	case 'none':
    		function findSex ($sex) {
    			return false; }
    
    		echo findSex("none");  // write a function to give a random sex
    	break;
    	default: echo $action = "*Drinks a redbull...*"; break;
    }
    
    echo "Hello world!";
    
    if ($bladder="full") { // Also always true, coffee will do that too you though...
    	$bathrooms = array('Starbucks', 'Truckstop', 'Grass', 'Sobe Bottle', 'Upstairs');
    

  3. Yeah, this really is one where you just want to go and do an ajax tutorial - w3schools is the one I used:

     

    http://www.w3schools.com/Ajax/ajax_intro.asp

     

    What you trying to do is the very definition of Ajax, and the tutorial posted shows you how to do it in a way that works for all the browsers, with error handling. Don't let the fact it uses asp worry you - your just printing out a few simple lines, which you can do in any language.

     

    To make debugging easier, I'd go get Firefox if you don't have it, and add file_put_contents('request.txt', print_r($_REQUEST, true)); at the top of my scripts.

  4. I have a row in a database that can be either be linked to an account or a location. It will always have an account_id, it might have a location_id.

     

    If it has a location_id, I want to return the linked row from the location table, otherwise, I want it to just return the record.

     

    Is there a way to select from two tables, but always select from at least one?

  5. Performance wise, is imagemagick any better or worse than GD? I generally only use imagemagick through the command line, in situations that require it, but I was thinking of just using the bind as a GD replacement, since 99% of what I use GD for is making thumbnails.

  6. Yeah, your doing it wrong.

     

    mysql_fetch_assoc returns an array as a row. So, if you want to get all the rows, you have to call it a bunch of times.

     

    So make this:

     

    if ($row = mysql_fetch_assoc($sql_query))

     

    this:

     

    while($row = mysql_fetch_assoc($sql_query)){

    // Some crap...

    print_r($row);

    }

     

    And see what it does.

     

     

×
×
  • 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.