Jump to content
ersaurabh101

Help needed in select command using table A and B

Recommended Posts

My command is 

$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 -

[
  {
    "ROWSNO": "2224",
    "COMID": "54578",
    "SNO": "31598",
    "TAG_FROM": "SAURABH"
  }
]

and i wish to include LATEST_ACTIVITY_NO in it

Share this post


Link to post
Share on other sites

You do realize that sql statements use case-sensitive names for the fields? Do you really have a field named 'comid' as well as 'COMID'? And is your php variable also $COMID?

Share this post


Link to post
Share on other sites

OMG! All this time I have been slaving away making sure of my case usage and now I find out what you knew all the time.

Don't know what made me think that case mattered....

 

What an idiot I am!

Share this post


Link to post
Share on other sites

OMG! All this time I have been slaving away making sure of my case usage and now I find out what you knew all the time.

Don't know what made me think that case mattered....

 

What an idiot I am!

I think it's better to maintain the same case anyway - using Linux a lot means you tend to get used to the fact that case matters in a lot of things (which is why table names can be case sensitive)

 

I'm a fan of camel case and I think it makes things more readable - but inconsistent use of case for the same field can (IMHO) lead to confusion.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.