Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Links Not Displaying IN PHP Query/Spider Results

Posted on 2003-11-30
3
308 Views
Last Modified: 2006-11-17
Hello,

I have a very simple database display script that pulls loops through the db ad retrieves a listing of articles in a table.

Here are the variables:

bo_id = Article ID
bo_title = Article Title

Here is the script below:

<?
$query="select * from biz_ops";

$result=mysql_query($query)
    or die(mysql_error());
echo "<table border=1>";

while ($row=mysql_fetch_object($result))
{
echo "<tr>";
echo "<td>Article ID:</td><td>$row->bo_id</td>";
echo "<td>Title:</td><td><a href='http://www.mysite.com/articles/$row->bo_id'>$row->bo_title</a></td>";
echo "</tr>";
}

echo "</table>";

mysql_close();

?>

Here is the line that actually creates my link to each article:

echo "<td>Title:</td><td><a href='http://www.mysite.com/articles/$row->bo_id'>$row->bo_title</a></td>";

This works great when I run the script on my site, BUT when I use a search engine spider simulation script it only shows the content displayed on the page and it won't recognize the links created by the script.

Here's a brief overview of how the spider simulator shows what it finds:

Article ID: 1 Title: Evaluate Online Needs For Others Article ID: 2 Title: Open An Import Shop Article ID: 3 Title: Turn Trash To Cash Article ID: 6 Title: Perform PR Services Article ID: 7 Title: Sponsor A Sports Site For Community Teams Article ID: 8 Title: Become A CyberAssistant Article ID: 9 Title: Found A Research Firm Article ID: 10 Title: Publish Newsletters For Yourself Or Other Biz Article ID: 11 Title: Begin A Promotional Biz

Now if I ad a hard coded link following my script, such as <a href="http://www.google.com">google</a> it will recognize this as an actual link and report it in the "Links found" section of the spider report.

Am I just coding my links in my script incorrectly and they are displaying when the spider parses the page?  Is there a way to make this work?  Here is the link to the spider I'm using to test my pages:  http://www.searchengineworld.com/cgi-bin/sim_spider.cgi

Thanks in advance,

Trent
0
Comment
Question by:wkpreferredsolutions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
lozloz earned 500 total points
ID: 9848388
unfortunately i can't look at the spider because it wants me to login. the spider will not be able to read the php source code so there is no way to can determine how you're creating the link - as long as it's there in the html product, it should catalog it. the best thing to do would be to compare your mysql_fetch_object version with your hard coded link version, examining the differences. i notice you use single quotes for the fetch_object script yet hard code with double quotes - maybe it only picks up links in double quotes? try:

echo "<td>Title:</td><td><a href=\"http://www.mysite.com/articles/" . $row->bo_id . "\">" . $row->bo_title . "</a></td>";

otherwise you can try replacing mysql_fetch_assoc for mysql_fetch_object and try:

echo "<td>Title:</td><td><a href=\"http://www.mysite.com/articles/" . $row["bo_id"] . "\">" . $row["bo_title"] . "</a></td>";

good luck progressing

cheers,

loz
0
 

Author Comment

by:wkpreferredsolutions
ID: 9854328
Thanks loz,

This was the KEY!!!

otherwise you can try replacing mysql_fetch_assoc for mysql_fetch_object and try:

echo "<td>Title:</td><td><a href=\"http://www.mysite.com/articles/" . $row["bo_id"] . "\">" . $row["bo_title"] . "</a></td>";

Thanks for the HELP!!

BTW, here is the link to the Spider Simulator if you ever have a need for it.  The link I posted earlier was wrong, this one doesn't require a login.
http://www.searchengineworld.com/misc/tools.htm

If you want to see the output I get (after your fantastic answer) just query this url:

http://www.homebizprimer.com/2ndquery.php

Thanks again!!

Trent

BTW:  I bumped the points up some for you.
0
 
LVL 13

Expert Comment

by:lozloz
ID: 9855100
glad to help

loz
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question