PHP Search Engine Ambiguous Columns

admin

Administrator
Staff member
hello all. i've driven myself absolutely mad the past couple days with this problem, and am reaching out for support. I'm a few weeks in to learning PHP/MySQL interaction, and have been trying to make use of a php based site search engine utility (DGSSEARCH) with limited success.

Everything works fine as long as I'm only querying one table in MySQL.

I'm trying to convert a 1000page static .html site to a PHP/MySQL driven site, and have created multiple tables and .php3 files using templates.inc from PHPLIB and a common .ihtml template to mirror the existing site structure (i.e., 'about.php3' works in conjunction with the table 'about' instead of /about/*.html, 'links.php3' works with the table 'links' instead of /links/*.html, etc.) Another reason for this division is that most of our end users are not very computer savvy, and i'm trying to keep the URLs looking the same. I'm using a column called 'page' in each table as primary key, and strings like 'index','contact','news' as keys instead of auto_increment. My .php3 files then obtain this key from the URL.

An example URL would be <!-- w --><a class="postlink" href="http://www.joeschmoe.com/main.php3/index.html">www.joeschmoe.com/main.php3/index.html</a><!-- w -->.

At the top of my .php3 files I have a line

'$page = ($PATH_INFO, 1, -5);' that extracts the primary key 'index' from that URL.

anyhow, as a result of all this i have multiple tables, all with 'page' column as primary key, some with redundant rows named 'index' (table about - index, table links - index, etc.) and when i try to search it using:

mysql_query("SELECT page, title, description, tbl FROM about, links WHERE about.page = links.page AND (keywords = '%[searchstring]%' OR description = '%[searchstiring]%') ORDER BY page, title, description, tbl");

i consistently get '1052: Column: 'page' in field list is ambiguous'

i'm searching the keywords+descriptions columns in my tables for [searchstring], and returning the page, title, description, and tbl columns for the matches. only title and description are displayed to end user, page and tbl are used to build the link URL under the search engine results.

i think i understand why i get the 'ambiguous' error, but have been baffled for two days as to how to work around it!

i hope i didn't provide too much information here. just a month or so ago i was just a graphic designer with very limited webmaster experience. now i'm eating, dreaming, and breathing php code... ::grin:: any help would be much appreciated.

-DolphinSnot-
 
Back
Top