SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    nothing happens please help

    de code as following:
    <? $state = mysql_query("SELECT pr_stateof
    FROM property WHERE property.pr_code=$select");
    $row = mysql_fetch_assoc($state);

    $resultstate = mysql_query("SELECT stateofpr_uk
    FROM stateofpr WHERE stateofpr.stateofpr_code={$row['pr_stateof']}");
    $row = mysql_fetch_assoc($resultstate);
    ?>

    <li>State of building: <? echo "{$row['stateofpr_uk']}";?></li>

    i picked up the value for statepr code from the property table
    now i want to pick up the value of that code in stateofpr table

    i did it like this but i don't get any result
    please help

  2. #2
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why don't you use a lookup table? then you could get the result with just one query.
    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.

  3. #3
    SitePoint Evangelist ClickHeRe's Avatar
    Join Date
    Mar 2005
    Location
    Ottawa, Canada
    Posts
    580
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not tested, but should be pretty close if it doesn't work

    you should check about JOIN statements on multiple tables

    PHP Code:
    <? 
    $query 
    "SELECT t1.stateofpr_uk FROM property as t1, stateofpr as t2 WHERE t2.stateofpr_code=t1.pr_stateof AND t1.pr_code='".$select."'");

    $state mysql_query$query );

    if ( 
    mysql_errno() > ) {
      echo 
    mysql_error( );
      exit;
    }

    $row mysql_fetch_assoc$state );

    ?>

    <li>State of building: <? echo $row['stateofpr_uk']; ?></li>

  4. #4
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hey guys thanx

    i have got it thanx you have been much help


Bookmarks

Posting Permissions

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