maybe this is just a typo - if not, shouldn't that be  .= versus =

$sql.= " ' " . $firstname . " ' , " ;

instead of

$sql = " ' " . $firstname . " ' , " ;



  ----- Original Message ----- 
  From: Wade 
  To: [email protected] 
  Sent: Monday, March 14, 2005 2:42 PM
  Subject: Re: [php_mysql] Re: value position as they go in a db


  03142005 1437 GMT-6
  I was running some tests after my last posting and I have noticed that 
  Im not getting any connection to the db. Using this script - which I use 
  all the time for testing - Im not getting any result. I restarted the 
  db. Restarted mysql but still Im not making a connection other than 
  through control center.

  Wade

  $db_name = "test";
  $connection = mysql_connect("localhost", "master", "getalife") or 
  die("Connection error <br />" . mysql_error() );

  $db = mysql_select_db($db_name, $connection) or die ("DB selection error 
  <br />" . mysql_error() );

  $sql = "INSERT INTO users (firstname, lastname, username, password) 
  VALUES (";
  $sql = " ' " . $firstname . " ' , " ;
  $sql.= " ' " . $lastname . " ' , " ;
  $sql.= " ' " . $username . " ' , " ;
  $sql.= " ' " . $password . " ' ) ";
     
  $result = mysql_query($sql, $connection);

  echo "Result of Insert: $result";
                    


  Pete wrote:

  >In message <[EMAIL PROTECTED]>, Kaela Street <[EMAIL PROTECTED]>
  >writes
  >
  >  
  >
  >>Technically, I understand that as long as the 'insert' and 
  >>the 'variable's are in the 'same sequence', then it does not matter 
  >>if they appear in that sequence in the database.
  >>    
  >>
  >
  >As far as I know, that is correct, but bad practice, because it makes it
  >more difficult to debug.
  >
  >However, here, the variables and field names don't match.
  >firstname, username, register, password, lastname
  >and
  >firstname, lastname, username, password, registerdate
  >
  >
  >  
  >
  >>>            $sql = "INSERT INTO test (firstname, username, 
  >>>      
  >>>
  >>registerdate, 
  >>    
  >>
  >>>password, lastname ) VALUES (";
  >>>                $sql = " ' " . $firstname . " ' , " ;
  >>>                $sql.= " ' " . $lastname . " ' , " ;
  >>>                $sql.= " ' " . $username . " ' , " ;
  >>>                $sql.= " ' " . $password . " ' , " ;
  >>>                $sql.= " ' " . $registerdate . " ' ) " ;
  >>>      
  >>>
  >
  >Doesn't matter what order they come in, as long as both sides match...
  >
  >  
  >


  [Non-text portions of this message have been removed]



  The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web 
database possibilities through group learning. 


        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to