Baffling MySQL error! ( 6 Views )

no kitty!
  1. This MySQL error has got me totally baffled! but maybe it just needs another pair of eyes to find out whats wrong, but here it is:

    this is the page: subcategories.php?cat=Explorations

    and this is the coding:

    Quote:

    <html>
    <head>
    <title>Items</title>
    <body topmargin=0 leftmargin=0 bgcolor=555555>




    <?php
    $connection = mysql_connect ("localhost", "******", "********");
    if ($connection == false) {
    echo mysql_errno().": ".mysql_error()."<BR>";
    exit;
    }

    $query = "select * from exp_dl_subcate where cat=".$catup;
    $result = mysql_db_query ("tnrstudios", $query);

    if ($result) {

    $numOfRows = mysql_num_rows ($result);
    for ($i = 0; $i < $numOfRows; $i++){
    $name = mysql_result ($result, $i, "name");
    $catup = mysql_result ($result, $i, "catup");
    $description = mysql_result ($result, $i, "description");
    $date = mysql_result ($result, $i, "date");
    $id = mysql_result ($result, $i, "id");

    echo "<b><font face=arial size=2 color=ffffff>$name - <br>$description - <br><br>$catup";
    }

    } else {
    echo mysql_errno().": ".mysql_error()."";
    }

    mysql_close ();
    ?>


    </table>
    </body>
    </html>
    and this is the error I get:
    1064: You have an error in your SQL syntax near '' at line 1

    IM BAFFLED! :p any help or ideas is appreciated :)

    (kamil, Latvia)

  2. Code:

    $query = "select * from exp_dl_subcate where cat=".$catup;
    but it should read
    Code:

    $query = "select * from exp_dl_subcate where cat=".$cat;

    (ertuğrul, Estonia)

  3. thanks, but now im getting this error:

    1054: Unknown column 'Explorations' in 'where clause'

    (adem , Indonesia)

  4. Oh, yes, sorry:

    Code:

    $query = "select * from exp_dl_subcate where cat='".$cat."'";
    But you should check out the articles on SQL Injections, this code is a security risk.

    (emel, Pakistan)



Related Topics ... (or search in 1.720.883 topics !)

baffling error message (3)
error message baffling me !? (6)
error 2002: can't connect to local mysql server through socket '/var/lib/mysql/mysql. (4)
server times out and mysql crashes giving mysql sock error (2)
mysql error from php but mysql control center & terminal works fine! (6)
mysql error?? error: can't create/write to file '\#sql2a_52_0.myi' (errcode: 13) (16)
error with sql statement when using mysql 5.0.24 (works fine in mysql 4.0) (3)
not a valid mysql result resource - mysql error 1064 (4)
baffling... (11)




copyright © 2007-2031 Pfodere.COM ( 6 Pfoyihuee Online )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
1.3015