Jump to content

phpakos

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by phpakos

  1. wildteen: it also contains text... it can be whatever...

     

    i used this code:

     

    $b = fgets($fh);

    $a = substr($b,0,-1);

     

    the second line removes the character which was causing the bug..

     

     

    any idea what that character is? I tried removing specifically the newline character but that wouldnt work.. so i figured it is another type of character...

     

    the $b variable is loaded from a file of this format:

    ...

    7

    9

    Hite

    6

    Princesha

    ....

  2. i have setup a database with this table structure:

     

    $query = "CREATE TABLE entry ( entryID int NOT NULL AUTO_INCREMENT,

    PRIMARY KEY(entryID),

    URL varchar(4096),

    name varchar(1024),

    kw tinytext )";

     

    I have filled in the database with data:

     

    entryID

    1

    URL

    http://www.bmwdealer.info/kwngat/9 Hite 6 Princesh...

    name

    02-Poni - Thashethemet-9 Hite 6 Princesha

    kw

    9

     

    (data copied from a sample row from phpmyAdmin).

     

     

    Now this is my code:

     

    $term = '1';

    $term2 = '9';

    $query = "SELECT * FROM entry WHERE entryID = '$term' AND kw='$term2' ";

    $result = mysql_query($query);

    $numresults = mysql_num_rows($result);

    echo $numresults."<br>";

    if(!$result)

    {

    die('Invalid query: ' . mysql_error());

    }

    else

    { //something was found..

    while($row = mysql_fetch_array($result))

    {

    echo "-Entry-<br>";

    echo $row['entryID']."<br>";

    echo $row['URL']."<br>";

    echo $row['name']."<br>";

    echo $row['kw']."<br>";

     

    }

    };

     

     

    THIS CODE DOESNT GIVE ANY RESULTS AND THE PROBLEM APPEARS TO BE THE: AND kw='$term2' part of the QUERY because if i remove it, it DOES produce the expected result.

     

    Any idea what is going on? Why is it not matching the kw field?

     

    Please help me out with this

     

    thanks alot, in advance..

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.