how to search mysql database by php code?

Please go to the url below to understanding my question
http://www.allit.com.my/index1.php
at that page you can see a column call HotDeal, please click a link below it and try.
it will come with a pop up screen and show the error message.
please help me!!! show me how to search the database

Comments

  • litter,

    Could you embellish on your question? I clicked the link and got a generic SQL error, but without knowing what you're trying to do or what your SQL code is, it's hard to answer the question.

    Generally speaking, "searching" an SQL database is done via the SELECT command. Example... Say you have a table called "products" containing a list of product data, each with a unique ID column called "productid". If you wanted to get a specific row, you'd format your query similar to: "SELECT * FROM products WHERE productid = 1;"

    An excellent place to learn some beginning SQL skills, plenty to get you rolling, is: http://www.sqlcourse.com/

    : Please go to the url below to understanding my question
    : http://www.allit.com.my/index1.php
    : at that page you can see a column call HotDeal, please click a link below it and try.
    : it will come with a pop up screen and show the error message.
    : please help me!!! show me how to search the database
    :
    :

  • This is my code , is that any problem ?


    <?
    include('Connections/haha.php');

    mysql_select_db("allit_allit");

    // <a href=popup.php?id=134>my link
    $result = mysql_query("SELECT * FROM hotdeal WHERE id=" + $_GET["id"]) or die(mysql_error());

    if(mysql_num_rows>0)
    {
    $row = mysql_fetch_array($result);

    $str_name = $row["Brand"];
    }


    ?>






  • That doesn't help... can you show your db schema?

    : This is my code , is that any problem ?
    :
    :
    : <?
    : include('Connections/haha.php');
    :
    : mysql_select_db("allit_allit");
    :
    : // <a href=popup.php?id=134>my link
    : $result = mysql_query("SELECT * FROM hotdeal WHERE id=" + $_GET["id"]) or die(mysql_error());
    :
    : if(mysql_num_rows>0)
    : {
    : $row = mysql_fetch_array($result);
    :
    : $str_name = $row["Brand"];
    : }
    :
    :
    : ?>
    :
    :
    :
    :
    :
    :
    :

  • String concatenation in php is done with the [.] character.
    So change your query to:

    $result = mysql_query("SELECT * FROM hotdeal WHERE id=" . $_GET["id"]) or die(mysql_error());


  • Oh Thanks .
    the problem is solve now .

    : String concatenation in php is done with the [.] character.
    : So change your query to:
    :
    : $result = mysql_query("SELECT * FROM hotdeal WHERE id=" . $_GET["id"]) or die(mysql_error());
    :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories