Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. If the field ID is a primary key or auto_increment, don't bother put it in the insert query.

     

    $query = "INSERT INTO `members` (`username`,`user_password`) VALUES('poky1','poky');";
    mysql_query($query) or die("The insert query failed because: " . mysql_error());
    

     

    give that a go.

  2. What you could do is just set up a global system that tells you where your folder points.

     

    You can use .htaccess or a method of php to solve this.

     

    # php
    $dash_switch = 1;
    
    $folder = ($dash_switch == 1) ? "himages" : "h-images";
    
    # if 1 folder = himages ;;; no hyphens
    # if 0 folder = h-images ;; hyphens.
    

     

    .htaccess wise

     

    RewriteEngine On
    
    RewriteRule ^/himages/([^*]*).gif$ /h-images/$1.gif [L]
    
    # or an opposite way
    RewriteRule ^/h-images/([^*]*).gif$ /himages/$1.gif [L]
    

  3. You can connect to more than one database and still use them in certain queries.

     

    $connection1 = mysql_connect("localhost","username","password");
    $dbconnect1 = mysql_select_db("databasename",$connection1);
    $connection2 = mysql_connect("localhost","otherusername","otherpassword");
    $dbconnect2 = mysql_select_db("otherdatabasename",$connection2);
    
    $query1 = mysql_query("SELECT * FROM `this` WHERE `that`='something'", $dbconnect1) or die(mysql_error());
    $query2 = mysql_query("SELECT * FROM `that` WHERE `something`='this'", $dbconnect2) or die(mysql_error());
    

     

  4. darkfreaks you've got a mess there.

     

    | should be || to specify you're wanting to use the PHP Operator "OR"

    = should be == to specify you're wanting to use the PHP Operator "is equal to"

     

    $yourArray = array($name, $album, $year, $price, $stock);
    
    if(in_array($yourArray,$array) || $album == $fname || $year == $fname || $price == $fprice || $stock == $fname){
    
    $display[] = $array;
       foreach($display AS $displays){
       echo $displays . "<br>\n";
       }
    }
    

  5. Ok. What I'm doing is checking to see whether the UID and Encrypted Password combination is correct.

     

    if($need_log > 0){
    $sql = "SELECT * FROM `users` WHERE `id`='{$_COOKIE['uid']}' AND `password`='{$_COOKIE['cpp']}'";
    $res = mysql_query($sql) or die(mysql_error());
    
    if(mysql_num_rows($res) == 0){
    setcookie("uid","",time()-314496000);
    setcookie("cp","",time()-314496000);
    setcookie("cpp","",time()-314496000);
    unset($_COOKIE);
    header("Location: /index.php");
    }
    }
    

     

    It does redirect the user to the index but the cookies remain unchanged and have the same values in the end. That's the exact code I have when the user wants to log out, and that works, but the code checked here does not work.

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