Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009

    Question Unanswered: Getting problem with retrieving text data from sql using PHP

    I am Using PHP. I want to retrieve a data from sql database.
    I got everything except the text type data.

    $strawinfo = "select CAW_Entry_Code,CAW_AGCITY,CAW_MEDIUM,CAW_CLIENT,CA W_SECONDARY,CAW_TITLE,CAW_WINNER,CAW_URL,CAW_CREDI T from Custom_Awards where CAW_id = '$caw_id' ";
    $rs_awinfo = odbc_exec($con,$strawinfo) or die(odbc_error());
    odbc_fetch_array($rs_awinfo) or die(odbc_error());
    $cw_entry_code = odbc_result($rs_awinfo,'CAW_Entry_Code');
    $cw_winner = odbc_result($rs_awinfo,'CAW_WINNER');
    $cw_secondary = odbc_result($rs_awinfo,'CAW_SECONDARY');
    $cw_agcity = odbc_result($rs_awinfo,'CAW_AGCITY');
    $cw_title = odbc_result($rs_awinfo,'CAW_TITLE');
    $cw_client = odbc_result($rs_awinfo,'CAW_CLIENT');
    $cw_media = odbc_result($rs_awinfo,'CAW_MEDIUM');

    $cw_credits = odbc_result($rs_awinfo,'CAW_CREDIT');
    //CAW_CREDIT is Text Type

    when i am displaying "$cw_credits" it don't show anything.

    Any body has a solution for this

    regards Neel

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    make sure the name is correclty spellt and correctly capitalised
    make sure there is some data in the column, ie you shuld get a value from the db
    ake sure the variable is correclty used elsewhere. $cw_credits is not he same as $cw_credit, nor is $cw_credits the same as $CW_credits
    are you getting some values for the other columns?

    Ive not used the odbc construct before, so Im assuming the basic set is ok, ie the other columns are being pulled through
    what happens if you do a debug (eg die (echo "CAW_CREDIT is ".odbc_result($rs_awinfo,'CAW_CREDIT'));
    or similar
    you could consider a test
    PHP Code:
    if (strlen(odbc_result($rs_awinfo,'CAW_CREDIT'))== 0
    } else
    $cw_credits odbc_result($rs_awinfo,'CAW_CREDIT');

    that will definately set a value in the $cw_credits so that will enable you to identify if the problem is the SQL or application logic after retrieving the data
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2009
    i getting value except Text type.
    i check database twice.
    i check some test..
    but i found some conversion problem..

    php default data type cant read text type of sql
    thanks for your response.

  4. #4
    Join Date
    Mar 2007
    In your SQL query you have a space in "CAW_CREDI T" so i'm not surprised it couldn't find that field. Of course it might just be the case that the field doesn't actually have anything in it (i.e. is blank)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts