Solved

Links Not Displaying IN PHP Query/Spider Results

Posted on 2003-11-30
3
304 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
Comment Utility
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
Comment Utility
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
Comment Utility
glad to help

loz
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now