Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

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