Results 1 to 7 of 7

Thread: [RESOLVED] Need the Delimiters to store an sql statement as a field in mySQL

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    38

    Resolved [RESOLVED] Need the Delimiters to store an sql statement as a field in mySQL

    php 5.0.4
    mySQL 4.1.11a

    I need to store the most recent query for each user when using a particular php script. The following works:

    Code:
      $session_userid = $_SESSION['userid'];
      $newquery = "update password_table set pwdQueryAddress = 'whatever' where pwdLoginId = '$session_userid'";
    and puts the string 'whatever' into the pwdQueryAddress field of the table.

    But what I really want, of course, is:
    Code:
      $query = "select * from address, name
    		where adrAddressId > 0
                              and adrAddressId = namAddressId
    		and adrDoNotCall like '$searchvalues[2]'
    		and adrStreetNumber like '$searchvalues[3]'
    		and adrStreetName like '$searchvalues[4]'
    		and adrUnitNumber like '$searchvalues[5]'
    		and adrZipCode  like '$searchvalues[6]'
    		and adrPrecinct like '$searchvalues[7]'
    		and adrWard like '$searchvalues[8]'";
      $newquery = "update password_table set pwdQueryAddress = '$query' where pwdLoginId = '$session_userid'";
    Which gives mySQL fits because it treats $query as part of the update statement, not as text.

    What's the delimiter I need aroudn '$query' to make mySQL treat it like common everyday characters?

    -Thx
    -MagicT
    Last edited by MagicT; Nov 30th, 2005 at 02:30 PM. Reason: changed vbcode to code tags
    MagicT

Posting Permissions

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



Click Here to Expand Forum to Full Width