Solved

Links Not Displaying IN PHP Query/Spider Results

Posted on 2003-11-30
3
309 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
[X]
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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ajax to record click 3 24
JQuery Search Filter 2 68
while read ID; do 4 53
PHP Curl Problem 10 33
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 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…

740 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