Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Links Not Displaying IN PHP Query/Spider Results

Posted on 2003-11-30
3
Medium Priority
?
313 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

730 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