Jump to content

vicodin

Members
  • Posts

    279
  • Joined

  • Last visited

    Never

Posts posted by vicodin

  1. step1. you can find php_mysqli.dll

     

    step2. and put that dll into c:\php\extensions\

     

    step3. that folder is not available, create it. now our dll file is in c:\php\extensions\php_mysqli.dll

     

    step4. go to php.ini, i thought that is in c:\windows

     

    step5. search "extension_dir"

     

    step6. after you found that you can set the path c:\php\extensions

     

    step7. inside the php.ini, go to the dll section (search dll as your text in the search box)

     

    step8. there is something like ;extension=php_mysqli.dll

     

    step9. if it is not available, you type the above thing and remove the semicolan (

     

    step10. save php.ini file and check it out.

  2. Ok so im trying to make a script that grabs the basename of a file in windows. It will always be run locally on the machine so when i used the function it is messing up. Im guessing it has something to do with the space?

     

    Example:

    $path="C:\Documents and Settings\office\Desktop\Web Design\CSVtoJPG Rename\test.txt";
    
    echo basename($path);
    

    Output is: CSVtoJPG Rename est.txt

     

    Any help anyone?

     

  3. Ok so i am looking to make a function that is capable of updating multiple MYSQL rows.

    Not sure how i would do this. I know how to make one for a single update but having trouble with making a function do multiple row updates.

    Example : Lets say i have row category and row category_name.

     

    I want a function that will allow me to do this.

     

    function UpdateDB($table,$rows,$updates,$where,$where_row_equals)

     

    Pretty much when i execute it i would like to be able to do this...

    UpdateDB("mytable","category,category_name","10,MyCatName","category","10");

     

    Any help would be greatly appreciated.

     

    P.S. Where i am having problems is the mysql syntax needs to be

    "SET $row1 = $update1  $row2 = $update2" and so on.

     

  4. I am getting a MYSQL Syntax error. I cant figure out what is wrong... can anyone help?

     

    mysql_select_db("MyTable") or die(mysql_error());
    mysql_query("UPDATE products SET cat = '{$cat}', subcat = '{$subcat}', 
    proname ='{$pname}', model = '{$model}', prodes ='{$pdes}', proid ='{$pid}', keywords ='{$pkey}', specs ='{$pspec}' WHERE proid = '$pid' ") or die (mysql_error());

     

    Error:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'products WHERE proid = '10057'' at line 1

  5. Ya i saw that after i posted... fixed it though... No that one is closed its the one after the else...

     

    include "connect.php";
    // Checks the database for a user with a particular user name
    $check = mysql_query("select ID from users where username='$username' limit 1;");
    // get a row count of the number of rows found
    if(mysql_num_rows($check) == 1) {  echo "Username Already In Use.";
    }
    else {  <----- ***This one is not closed***

     

    My code above should fix the issue

  6. This should do it.

     

    <?PHP
    
    include "connect.php";
    // Checks the database for a user with a particular user name
    $check = mysql_query("select ID from users where username='$username' limit 1;");
    // get a row count of the number of rows found
    if(mysql_num_rows($check) == 1) {  echo "Username Already In Use.";
    }
    else {
    
    if(isset($_POST['submit']))
    
    {
    
       $username=$_POST['username'];
    
       $password=$_POST['password'];
       
       $email=$_POST['email'];
    
       if(strlen($username)<1)
    
       {
    
          print "You did not enter a username.";
    
       }
    
       else if(strlen($password)<1)
    
       {
    
          print "You did not enter a password.";
    
       }
    
       else
    
       {
    
        $insert = "INSERT INTO `users` (username,password,email)
        VALUES ('".mysql_real_escape_string
       ($username)."','".mysql_real_escape_string
       ($password)."','".mysql_real_escape_string
       ($email)."',".mysql_real_escape_string;
         
          mysql_query($insert) or die("Could not insert comment" . mysql_error());
          
            echo "User Added. <a href=\"home.html\">Click here</a> To Go Home.";
       }
    
      }
    }
    ?> 

  7. Hello all i am trying to compare dates and find out if the person signed up this month or before this month. So i came up with this and it works but was wondering if there was a better way to do it.

     

    $signup = "2008-10-09";//<-- What ever date is pulled from DB
    $date = date("Y/m");
    $date.= "/01";
    $date = strtotime($date);
    $signup = strtotime($signup);
    if ($signup > $date){
    echo 'Signed Up This Month';
    } else {
    echo ' Signed Up Before';
    }

  8. Hello all, lets say i have some users and when they made their account the made the username: John Doe. now they go to sign in and they type in john doe instead of John Doe. Will MYSQL see it the same either way? If not how can i make it so MYSQL will get it the same everytime but i also want their name to be to show up on the site the same way they made it when they registered?

  9. Hello all, I am not all that great with MYSQL but i was just wondering something... Usually if i am storing a true or false value in to my db i just have it a 0 or a 1. Instead of having MYSQL look for a 1 or 0, would it be better or faster to start using IS NULL or IS NOT NULL in my statements?

  10. Ok i have a script db.php which is all my db connection info. Can i put:

    mysql_select_db("MyDB") or die(mysql_error());

     

    in that db.php file as well so i dont need to call it with everyone of my functions(as long as i am selecting the same db) or should i call it with every function?

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