On Thursday 16 January 2003 17:17, WMB wrote:

Please use a descriptive subject!

> Am trying to get rid of spaces and change all into uppercase in an entered
> form variable, which I am able to do when trying things out but when
> running the full php statement it refuses to change and enters the original
> variable into the database anyway. Haven't got a clue why.
>
> Please, what's wrong with the following:
>
>  if(mysql_result($query, 0, 0) == 0)// && (mysql_result($query2) > 0)#)
>           {
>           $password = md5($_POST['strPassword']);
>           $newstrUserName = $_POST['strUsername'];
>           $newstrUserName = strtoupper(ereg_replace(" ", "",
> $newstrUserName));

So here if you echo $newstrUserName, it is correct and what you had expected?

>           $strQuery = "INSERT INTO users (";
>           $strQuery .= "`username`, `password`, `level`, `firstname`,
> `lastname`, `ngfnummer`, `email`) VALUES (";
>           $strQuery .= "'$newstrUserName', '$password', '1',
> '{$_POST['strFirstName']}', '{$_POST['strLastName']}',
> '{$_POST['strNgfnummer']}', '{$_POST['strEmail']}')";

What if you now echo $strQuery? Is it still what you expected?

>                 if(mysql_query($strQuery)) etc etc etc

And you should have error checking in your code, something like:

  if (mysql_query($strQuery)) {
     do_your_stuff; }
  else { //an error
    echo mysql_error();
  }

or checkout the examples in the manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
The most costly of all follies is to believe passionately in the palpably
not true.  It is the chief occupation of mankind.
                -- H.L. Mencken
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to