Jump to content

Spring

Members
  • Posts

    224
  • Joined

  • Last visited

Posts posted by Spring

  1. To put it in easier terms

     

    This checks to see if either one of this are not true, continue.

    So if the person doesn't have Vista AND windows7 they're screwed.

    if(!ubuntu() || !xp() || !vista() || !win7() || !firefox() || !chrome() || !safari() || !ie9() || !ie8()){
    
    }

     

    This will check that at least one is true. If one of those functions are true then continue.

    So if the person has at least VISTA they're okay.

    if(!ubuntu() && !xp() && !vista() && !win7() && !firefox() && !chrome() && !safari() && !ie9() && !ie8()){
    
    }

     

    I had in my original code:

     

    
    if(!ubuntu() || !xp() || !vista() || !win7() || !firefox() || !chrome() || !safari() || !ie9() || !ie8()){
    echo'<strong>';
    echo '<br />' . $_SERVER['HTTP_USER_AGENT'] . '<br /><br />Administrator someone in your work force is using an unsupported browser/OS combination, please email the information above to the developer of the NCMR software you are using. It will allow your browser/OS combination  to be used correctly. Sorry for the inconvenience.</strong> <br /><br />Please copy and paste the text above and send it to your web administrator. It will explain everything he/she needs to do.';}
    

     

    So tell me even if have one of the variables above it shows?

     

    Yes, which why you need to use && instead of ||

    And those are functions, not vars.

  2. To put it in easier terms

     

    This checks to see if either one of these are not true.

    So if the person doesn't have Vista AND windows7 they're screwed.

    if(!ubuntu() || !xp() || !vista() || !win7() || !firefox() || !chrome() || !safari() || !ie9() || !ie8()){
    
    }

     

    This will check that at least one is true. If one of those functions are true then continue.

    So if the person has at least VISTA they're okay.

    if(!ubuntu() && !xp() && !vista() && !win7() && !firefox() && !chrome() && !safari() && !ie9() && !ie8()){
    
    }

  3. I originally wanted to create this as a variable, but I wasn't too sure how to do that in this instance, because HTTP_USER_AGENT is already outputting data.  Would the output be a variable?

     

    Also, there still has to be a way of showing a double negative as far as I can tell because at a time the browser and OS will not be used, and a new one will be developed.

     

    If you want to make this easy on yourself, just use the logical AND.

  4. Where exactly is $this->db defined? Iv'e not used CodeIgnitor because I believe it is poorly designed, I don't however think it is that poorly designed that it would setup a database connection within a Controller.

     

    Database interaction belongs in your Models, not your Controllers.

     

    ps: .htaccess has NOTHING AT ALL to do with your issue.

     

    $this->db is defined in the autoload, which is the first line of code at the top. I have no database interaction in my controller, that is the model I'm using. I should not have to define the DB class if I use the auto load. It's ridiculous. I have an almost 100% similar file, and it's works just fine. I honestly don't have the patience to be stuck on errors like this...

     

    Also, I think I just found the error now..I need to stop programming late night. I'm going to have a heart attack.

  5. <FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD=get>
    <input type="text" name="band" value="<?php echo $_GET['band']; ?>" /> 
    <input type="text" name="bust" value="<?php echo $_GET['bust']; ?>" /> 
    
    <INPUT TYPE=submit VALUE="Calculate">
    </FORM>
    
    
    <?php
    if(isset( $_GET['band']) && isset($_GET['bust']) ){
    $band = $_GET['band'];
    $bust = $_GET['bust'];
    
    $query = sprintf("SELECT size FROM bra_calculator  WHERE band='%s' AND bust='%s'", mysql_real_escape_string($band), mysql_real_escape_string($bust));
    $result = mysql_query($query);
    
    if (!$result) {
       echo "no";
    }
    else {
    while ($row = mysql_fetch_assoc($result)) {
       echo $row['size'];
    }
    }
    mysql_free_result($result);
    }
    
    else{
    echo "N/A";
    }
    ?>
    

     

    http://us3.php.net/isset

     

  6. Thanks guys. Seriously. I have absolutely no doubt in my mind whatsoever that I would have quit attempting to learn PHP without this forum. I don't consider myself as the 'type' of person suited to being a programmer at all. I just really do have difficulties picking up on things. Things that some people can see once and understand, may take me three or four times to grasp. Dunno, I may just be stupid lol. Anyway, I want to give thanks to everyone who has been patient with me and has helped me through my problems. I have had very little trouble with anyone here! Even though, sometimes, the sarcasm does get a bit annoying.

     

    The two who I remember most clearly and who deserve a special thanks:

    PFMaBiSmAd

    and

    Thorpe

     

    and thanks to everyone else who has helped! Sorry for forgetting you!

  7. THESE ARE BEING LOADED GOD DAMMIT

    $autoload['libraries'] = array('database', 'image_lib');

     

    I seriously can't do this without loading the database directly! I get: Call to a member function get() on a non-object WHEN I DONT LOAD THE DB DIRECTLY

     

    class Port_model extends CI_Controller {
    
    function __construct() {
    	parent::__construct();
    }
    
    function getData()
    {
    	$query = $this->db->get('port');
    
    	if ($query->num_rows() > 0) {
    		//Lets get our data from announcements and pass it to an array
    		foreach ($query->result() as $row) {
    			$data[] = $row;
    		}
    	} return $data;
    }
    
    }

     

    and i think its the damn .htaccess!!!

    ALSO, I CANT LOAD THE IMAGE LIB LIBRARY WITHOUT GETTING A SIMILAR FUCKING PROBLEM. IS THIS THANKS TO .HTACESS!?

     

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /ci/
    
        #Removes access to the system folder by users.
        #Additionally this will allow you to create a System.php controller,
        #previously this would not have been possible.
        #'system' can be replaced if you have renamed your system folder.
        RewriteCond %{REQUEST_URI} ^system.*
        RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
        
        #When your application folder isn't in the system folder
        #This snippet prevents user access to the application folder
        #Submitted by: Fabdrol
        #Rename 'application' to your applications folder name.
        RewriteCond %{REQUEST_URI} ^application.*
        RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
    
        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, all 404's
        # can be sent to index.php, and everything works as normal.
        # Submitted by: ElliotHaughin
    
        ErrorDocument 404 /index.php
    </IfModule>  

     

  8. <?php
            $db = new Database();
    
    $q = "SELECT 
    	post_id,
    	post_title,
    	post_subtitle, 
    	post_body, DATE_FORMAT(post_created, '%M %D %Y') AS created_on,
    	post_ext_link
    	FROM blog 
    	ORDER BY post_id DESC
    	LIMIT 3";
      
            $r = $db->query($q); 
          if (mysqli_num_rows($r) > 0) {	 
    		  while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
    		  echo
    		  "<h2>" . $row['post_title'] . "</h2>" .
    		  "<h3" . $row['post_subtitle'] . "</h3>" . 
    		  "<p" . $row['post_body'] . "</p>" .
    		  "<p" . $row['created_on'] . "</p>"
    		  ;
        	}
    	  } else {
    	  	echo '<p>No posts to display at present.</p>';
    	  }
    ?>

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