New to MySQL

    Date: 03/17/05 (MySQL Communtiy)    Keywords: php, mysql, database, sql

    Alright, so I'm a bit new to MySQL. I haven't had to work with databases much, and when I have done them, it was with Access (Ick!). Anyway, i've got a php page that I'm trying to connect to a MySQL database. This isn't how the data's going to be displayed, obviously, but I'm unsure where to go from here.


    // Connecting, selecting database
    $connect = mysql_connect('localhost', 'mannsye', 'nickmann1169');
    if (!$connect)
    die('Could not connect: ' . mysql_error());
    else
    echo "Connected successfully

    ";

    $category = 1;

    mysql_select_db("mannsye_conigeninformation") or die("Could not select database");

    // Performing SQL query
    $query = "SELECT * FROM residental_links, residental_types ";
    $query += "WHERE ((residental_links.section)=(residental_types.type)) ";

    $query += "ORDER BY residental_types.index, residental_links.name;";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    // Free resultset
    mysql_free_result($result);

    // Closing connection
    mysql_close($connect);
    ?>


    I've got my query seperated from the code, but as I know very little about MySQL, I don't know if the syntax is correct or not.


    SELECT * FROM residental_links, residental_types
    WHERE ((residental_links.section)=(residental_types.type))
    ORDER BY residental_types.index, residental_links.name;


    Whenever I try and access the database and the tables, I can connect, but I can't display any data.



    Connected successfully

    Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1



    Please, any help would be appreciated.

    Many thanks!
    --Lisa

    Source: http://www.livejournal.com/community/mysql/50953.html

« Timestamping and datetime || mysql help... anyone have... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home