Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help needed in select command using table A and B

    My command is

    PHP Code:
    $stmt2 "select rowsno , comid , sno , tag_from FROM tasktag where COMID='$COMID' and  TAG_FROM = '$TAGFROM'"

    I want to fetch 1 more value in it but from a different table using the sno from the above select command

    If wish to fetch LATEST_ACTIVITY_NO from admtask where sno = sno

    I want this inside stmt2 command only because its returning an array like this -
    PHP Code:
    [
      {
        
    "ROWSNO""2224",
        
    "COMID""54578",
        
    "SNO""31598",
        
    "TAG_FROM""SAURABH"
      
    }

    and i wish to include LATEST_ACTIVITY_NO in it

  2. #2
    Senior Coder benanamen's Avatar
    Join Date
    Oct 2015
    Posts
    1,092
    Thanks
    2
    Thanked 117 Times in 114 Posts
    Your code is bad. You NEVER EVER put variables in a query. You need to be using prepared statements.
    To save time, lets just assume I am almost never wrong.

    The XY Problem
    The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

    "This text has been encoded with ROT26. If you can read this you must have found a backdoor. Congratulations!"


 

Tags for this Thread

Posting Permissions

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