Results 1 to 6 of 6

Thread: mysql search not happening

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    mysql search not happening

    I don't know where I went wrong but the query isn't taking place:
    PHP Code:
    <?php
    $con 
    mysql_connect("","root","");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("boti_book"$con);

    $sql "SELECT content FROM boti_pages WHERE content LIKE 'Fritz'";
    $result mysql_query($sql);
    echo 
    $sql;
    while(
    $row mysql_fetch_array($result))
      {
      echo 
    $row['content']."<br />\n";
      }
    mysql_close($con);
    ?>
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: mysql search not happening

    If you use mysql_error() you will be able to find out why
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: mysql search not happening

    Quote Originally Posted by visualAd
    If you use mysql_error() you will be able to find out why ;)
    It's there already. Look in the code I posted above.
    I don't think there's any error because I typed:
    echo "hi";
    to test if it's going to output it. And it did.
    Compare bible texts (and other tools):
    TheWheelofGod

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: mysql search not happening

    You need to use it after the query too. If the result is false then the query failed.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: mysql search not happening

    Quote Originally Posted by visualAd
    You need to use it after the query too. If the result is false then the query failed.
    Oh ok. But how?
    $result = mysql_error()?
    Compare bible texts (and other tools):
    TheWheelofGod

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: mysql search not happening

    PHP Code:
    .....

    if (! 
    $result) {
     
    mysql_error($conn);

    .... 
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

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