Computers |
|
| | #1 (permalink) |
| Newb Techie Join Date: Dec 2006
Posts: 1
| 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: Search Engine Optimization "Search Engine Optimization" 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 |
| | |
| | #2 (permalink) |
| Dope Tech | use mysql_fetch_assoc() to retrieve row results http://www.php.net/manual/en/functio...etch-assoc.php PHP Code:
__________________ Tech IMO.com | ExtremeTech.com | ASP Free.com | SysOpt.com | Tech Support Guy.org DB Forums.com | Cyber Tech Help.com | Lazy Forums.com | Warrior Nation.net 'If you don't stand for somethin you'll fall for anything' - Dr. Dre Been there, done that |
| | |