SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    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?
    PHP Code:
     $cid JRequest::getVar('cid');
                
    $link 'index.php?option=com_greekapp&controller=company&task=edit&user_id='.$cid.''
    All those who wander aren't lost.

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    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:
    PHP Code:
    $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:
    PHP Code:
    $link "index.php?option=com_greekapp&controller=company&task=edit&user_id='{$cid}'"  

    you can simplify it to this if cid is an number:
    PHP Code:
    $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):
    PHP Code:
    $link "index.php?option=com_greekapp&controller=company&task=edit&user_id=" $cid 

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,493
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by nofel View Post
    is there something i m doing wrong in query?
    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.


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
  •