View Single Post
Old 12-15-2006, 04:17 PM   #1 (permalink)
FuzzyLogik
 
Newb Techie

Join Date: Dec 2006

Posts: 1

FuzzyLogik

Default Need a bit of help with PHP/MySQL (getting the value of a cell)

Perhaps my problem is I cannot echo the value, as it returns a resource ID.

Here is my code:

Code:
if ($word != "") {
        if ($word == "encyclopedia") {
        echo("

Welcome to the encyclopedia!  Here you will find the meanings of key phrases, such as JavaScript, CSS, and XML.  Remember, you can always access words in the enyclopedia by appending it to the url, e.g. \"http://phazm.net/AJAX\". This will bring up the description of that word.  Enjoy!"); } else {
        $spaces = array("%20", " ", "_", "+", "-", ".");
        $word = str_replace($spaces," ",$word);
        require_once($includes . "connect.php");
        $query = "SELECT * FROM resource WHERE title = '" . $word . "'";
        $result = mysql_query($query);
        $number = mysql_numrows($result);
        $row = mysql_fetch_row($result); 
        $wordid = $row[word_id];
        echo($row . "- Row
WordID is " . $wordid);
        if($number != 0) {
        $query = "SELECT * FROM redirect WHERE word_id = '" . $wordid . "'";
        $result = mysql_query($query);
        $number = mysql_numrows($result);
            if($number <= 1) {
            echo($result);
            } else {
            echo("There are " . $number . " entries for " . $word . ".");
            }
        } else {
        $word = str_replace($spaces," ",$word);
        echo("<h2>" . $word . "</h2>

We have no documentation for " . $word . ".  Please check back later.</p>");
        }
        }
        }
    ?>

Most of that you don't need, but to put at ease those who say "SHOW THE FULL CODE!" - there ya go

Basically, I want to return the ID of the first call.

Search for: SEO

"SEO" is in "title" column of "resource" table, and it's ID (auto_increment) is 8.

How do I get 8?

If I am confusing you, I will rephrase, just ask

Thanks
FuzzyLogik is offline