Query not working propely

hi,
i am working on a php project and i m trying to match uid with cid but my cid is null. whereas in back end, cid table has value. is there something i m doing wrong in query?

 $cid = JRequest::getVar('cid');
            $link = 'index.php?option=com_greekapp&controller=company&task=edit&user_id='.$cid.'';

Bad use of quotes seems to be the problem;

you have what may seem a bewildering array of options

single quotes (for sql) inside double quoted string:


$link = "index.php?option=com_greekapp&controller=company&task=edit&user_id='".$cid ."'"  ;

use {} brackets to help the interpreter delineate the variable inside a double quoted string:


$link = "index.php?option=com_greekapp&controller=company&task=edit&user_id='{$cid}'"  ;

you can simplify it to this if cid is an number:


$link = "index.php?option=com_greekapp&controller=company&task=edit&user_id={$cid}";  

or even this, use concatenation (as cid is the last item, as long as it is a number of course):


$link = "index.php?option=com_greekapp&controller=company&task=edit&user_id=" . $cid ;  

What query? There is no query in the code you posted. If the link you create has no value for cid, then apparently JRequest::getVar(‘cid’) returns nothing.