Thread: mysql and php

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    brussels
    Posts
    7
    Rep Power
    0
    I am calling some data from my sql database into a form in a php4 script, most of my datas are the text like " john devis argentar", but when the data is called to my form It only displays the first part of data ( "john" is displayed instead of "john devis argentar").
    I have tried urlencode and urldecode fonction but what I get is: "john+devis+ argentar".
    It should be very nice if some one could help me with this topic as I am in it since last week without any success.

    Best regards,
    Mashadi

    ------------------
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Seaside, CA
    Posts
    84
    Rep Power
    15
    mashadi,

    I don't know how your table is set up or what your SELECT statement is, so I don't know if this will help. But, for example, if your first, middle, and last names are in three different fields, just do something like:

    echo "$first $middle $last";

    You might also have to strip any extra space from the field.

    ------------------
    From the day we're born, we're running out of time.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    brussels
    Posts
    7
    Rep Power
    0
    I have a field like street address 1, then you put the name of street which is in three part like "ali mashadi avenue", here I get the problem .

    Thanks for any help.
    Best regards
    Mashadi

    ------------------
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Seaside, CA
    Posts
    84
    Rep Power
    15
    Mashadi,

    I still don't know if I understand the problem. Are you pulling the data from a table and putting it into a text field in a form so users can modify it? If so, there's no reason that all the text wouldn't be displayed unless your text box isn't long enough. For example, if your MySQL "address 1" field has a size of 20, you want your text box to be that length as well (input type="text" size=20) etc. Or, if you don't have enough space on the page for some reason, you can set the size to, say, 10 and the maxlength to 20, etc.
  8. #5
  9. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Mashadi,

    try to use addslashes() function before inserting your values to the database.

    probably you may use stripslashes() function when you retrieve it from database.

    i hope that will work..


    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited August 13, 2000).]
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    Sounds like maybe you are not using quotes in your value attribute.
    if $somevariable was something like John Smith

    printf('<input type="text" name="Street Address 1" value="%s">', $somevariable);
    This would return value="John Smith"


    printf('<input type="text" name="Street Address 1" value=%s>', $somevariable);
    This would return value=John

    Hope that helps
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Indonesia
    Posts
    87
    Rep Power
    15
    That problem happened to me too.
    And I can solve it by adding " sign.

    Example : I take from the database the result is in $address1

    then u can display it by :
    <input type=text name=addres1 value="<? echo $address1 ?>" size=50>

    Try it !!!!
    It works for me !!!!



    ------------------
    ** It's the world of Oscario **
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Austin, TX, USA
    Posts
    11
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
    <input type=text name=addres1 value="<? echo $address1 ?>" size=50>
    [/quote]

    This works for all form elements. Start experimenting with it because it the best and perhaps only way to display info in form elements! I use it at work all the time.

    ------------------
    Dave Bryant
    dbryant@jump.net

Similar Threads

  1. Check MySQL Version thru PHP
    By wolftrap1 in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 09:51 PM
  2. Replies: 0
    Last Post: February 11th, 2004, 12:44 AM
  3. Replies: 0
    Last Post: January 30th, 2004, 02:22 PM
  4. PHP 5 (MYSQL vs. SQLite)
    By ignition in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 01:13 PM
  5. PHP Reconfig with mysql...
    By Legendary Fox in forum PHP Development
    Replies: 3
    Last Post: January 23rd, 2004, 12:46 AM

IMN logo majestic logo threadwatch logo seochat tools logo