close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DA Drop down references another table - won't reverse reference...

Thread began 9/09/2010 12:42 am by ken413883 | Last modified 9/10/2010 5:44 pm by ken413883 | 596 views | 5 replies |

ken413883

DA Drop down references another table - won't reverse reference...

I am building a tool to track some my characters for an MMORPG.

I have a table that contains every spell for every class (spell) containing:

spell_id
spell_name
spell_class_id
spell_level

I also have a table that contains every class:

class_id
class_name

In the DA wizard for the spell table, I used the class table to make a drop down menu for searching (there are no update or insert screens for the spell table, that happens via database insert).

The issue I am having is getting class.class_id to relate to spell.spell_class_id in the original lookup. Right now, the URL shows (||||| just to show where the call is...)

spell_Results.php?S_spell_name=&S_spell_level=&|||||S_spell_class=9|||||&Search.x=36&Search.y=4&Search=Search

I believe (S_spell_class) relates to class.class_id (according to the wizard settings) and I need (S_spell_class) to some how reference spell.spell_class_id...

If I search using any of the other criteria, I get the appropriate result and details pages, and the INNER JOIN statement works just fine for displaying, just not for the original search/query...

Here is the SELECT statement from the results page (which works to display the search results...)

SELECT
spell.spell_class_id,
spell.spell_name,
class.class_name,
spell.spell_level,
class.class_id
FROM
spell
INNER JOIN class ON spell.spell_class_id = class.class_id

Thoughts?

Sign in to reply to this post

Dave BuchholzBeta Tester

can you post the page that this code is on as this will make tracking down the issue easier

Sign in to reply to this post

ken413883

Sure Can...

As you can see in the attached files...

Spell_Search.php is the search page
Spell_Results.php is the page with the problem
Spell_Details.php mostly irrelevant (I think) but I included it anyway in case I am wrong.

Note that all 3 pages work fantastically as long as the search doesn't include "class"

Attached Files
spell_Results.zip
Sign in to reply to this post

Dave BuchholzBeta Tester

In Line 21 of spell_Results.php replace this code

$WADbSearch1->addComparisonFromList("spell_class","S_spell_class","AND","Includes",0);



with this code

$WADbSearch1->addComparisonFromList("spell_class_id","S_spell_class","AND","=",1);



and you should be good to go

Sign in to reply to this post

Jason ByrnesWebAssist

this line:

php:
$WADbSearch1->addComparisonFromList("spell_class","S_spell_class","AND","Includes",0);




is creating a search criteria using a column named "spell_class".

in your origianl description of the database:

  I have a table that contains every spell for every class (spell) containing:

spell_id
spell_name
spell_class_id
spell_level

I also have a table that contains every class:

class_id
class_name  



you do not mention a column named "spell_class", nor is there a column named "spell_class" returned from your recordset:

SELECT
spell.spell_class_id,
spell.spell_name,
class.class_name,
spell.spell_level,
class.class_id
FROM
spell
Inner Join class ON spell.spell_class_id = class.class_id




did you mean to use "class_name" instead?

php:
$WADbSearch1->addComparisonFromList("class_name","S_spell_class","AND","Includes",0);



or spell_class_id?

php:
$WADbSearch1->addComparisonFromList("spell_class_id","S_spell_class","AND","Includes",0);
Sign in to reply to this post

ken413883

Fixed!!

Dave hit it right on the head! It works!!

Thanks Dave!!!

Jason - you are correct though...I mis-spoke (typed?)

The Class Table only has 2 columns:
Class_id
Class_name

All other tables in the database use Class_id to reference the class table, generally with tablename_class_id.

I hope that made sense. I know what I mean, I'm just having trouble at explaining it...I'm just learning code and databases (been modeling data for a while now...so I know the lingo...just don't know what buttons to push... :-)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...