SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sent varibles...

    Sorry folks....it should be easy, but for me, well.....

    i send varibles to a page, which in turn should complete a query.

    For example i have test.php?Cata=Sedie&Cat4=case1. The 'Sedie' and 'case1' are created by the record.

    In the query i have used
    Code:
    $test1 = $_GET['Cata'];
    $test2 = $_GET['Cat4'];
    $query_product = "SELECT * FROM product WHERE cat1 = $test1 AND $test2 = 'y' ORDER BY id ASC";
    $product = mysql_query($query_product, $funari) or die(mysql_error());
    $row_product = mysql_fetch_assoc($product);
    $totalRows_product = mysql_num_rows($product);
    ...and i get the error

    HTML Code:
    Unknown column 'Sedie' in 'where clause'
    ..but the column is 'cat1', not Sedie'

    im very confused, thanks in advance

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,273
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    change this --
    Code:
    WHERE cat1 = $test1
    to this --
    Code:
    WHERE cat1 = '$test1'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers Rudy
    I tried every combination of single and double quotes...but not yours!


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
  •