Better way to retrieve data from MySQL table?


I’m using the following code to create pages:

@mysql_select_db($database) or die( “Unable to select database”);
$query=“SELECT * FROM table WHERE id=’$id’”;

while ($i < $num) {

<? echo "$title"?> <? echo "$content"?> <? ++$i; } ?>[/code]

It seems, however, that page content is not being indexed by google (or server stats). For example, google will find page.php but not page.php?id=1.

Is there a better way to retrieve data from a MySQL table?


Google uses spidering techniques to index a website’s pages. Do you have any links to page.php?id=1 on page.php or on any other accessible (and indexed) page on your website?

Hey Zyppora,

I have links but they are written out on the page like ""

I JUST realized that this doesn’t help google too much because they like words to be the link not just the link itself.

Sometimes the simplest things mess me up ;)

Thanks for the reply.

Just out of curiosity, is there a better way to pull info (longtext HTML content) from a mysql db to display on a page? Looking at wordpress’ code, i don’t see a lot of “echos.”


I’m not familiar with wordpress, but I know most CMS systems use templating to display their output. Echo and print are the basics for sending output to the client, but there are other ways to do so. I consider a database to be suitable for storing large chunks of text though.

Sponsor our Newsletter | Privacy Policy | Terms of Service