Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP string weirdness

Options
  • 06-02-2002 1:10am
    #1
    Registered Users Posts: 2,518 ✭✭✭


    I've got a PHP script going here which gets data about a user from a DB and sticks it into some form fields for editing and updating.

    Thats all well and good but it seems to be printing out the data into the fields with a large amount of leading white space.

    I'm thinking it might be somthing to do with the field sizes in the DB itself since the ones that print out the largest amount of white space have large field sizes (char(30)). This field is holding the users 'real name' consisting of first and second name.

    Is there a regex or somthing I can use to parse the white space out before printing the data to the fields?


Comments

  • Registered Users Posts: 1,842 ✭✭✭phaxx


    trim(), rtim(), ltrim(), I believe. Check out the list of string functions on www.php.net/manual/en/


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    ltrim() is the kiddy. Odd that you're getting prepended webspace - MySQL has a ZEROFILL attribute, but that's for integers. What DB are you using?

    adam


  • Registered Users Posts: 2,518 ✭✭✭Hecate


    ah probably should have mentioned that :), Postgres 7.1


Advertisement