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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP string weirdness

  • 06-02-2002 12:10am
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 2,518 ✭✭✭Hecate


    ah probably should have mentioned that :), Postgres 7.1


Advertisement