close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Replacing ID key with column Name

Thread began 9/23/2009 4:33 am by jenkolaka19379118 | Last modified 9/25/2009 8:04 am by jenkolaka19379118 | 2375 views | 7 replies |

jenkolaka19379118

Replacing ID key with column Name

I have looked at the help on this forum concerning the INNER JOIN but I am still a little confused how to execute this MYSQL statement manually.

I have table1 (courses) and reference table2 (course_category).

I have a foriegn key in courses called subject_cat_id. This is the primary key in refernce table 2 (course_category).

After using dataassist wizard, my insert record behaviour, sql statement on my results page looks like this:


SELECT course_id, subject_cat_id, course_title, course_code, course_price

FROM courses



I have tried to do an inner join;


SELECT courses.course_id, courses.subject_cat_id, courses.course_title, courses.course_code, courses.course_price, course_category.course_category_title,

FROM courses

INNER JOIN course_category

ON courses.subject_cat_id = course_category.course_cat_id



I keep coming up with mysql errors. I really need to replace subject_cat_id with subject_category_title, from (table2) course_category on my rsults page.

Sign in to reply to this post

tom92909Beta Tester

The 1st thing I see is the extra comma that needs to be removed...

course_category.course_category_title, <<<< delete that comma and try again.

Sign in to reply to this post

Jason ByrnesWebAssist

Good catch Tom, the extra comma will cause an Error.


If you still get an error after removing the coma, please post the text of the error. the error may hold some additional clues to the cause.

Sign in to reply to this post

jenkolaka19379118

Thanks Guys

Hi Tom and Jason,

That extra comma was the problem, Thank you so much.

The only problem now is I am not sure what to do to my results page to effect the change to the mysql statement. Even though the sql statement executed successfully on the "test button", when i exit the recordset window my results page remains exactly the same.

Sorry to ask so many questions, but i have a grave fear of messing up my php code and destroying the whole page.

Do I perhaps have to create another column in my results table and echo the data, and how do I remove/ replace the id column for the name column on the results table safely(without damaging the server behaviours and the php code)?

Sign in to reply to this post

tom92909Beta Tester

1st thing. Make Backups often!

Next. Just add a couple of extra <td></td> tags to your result output and then add some columns and see what happens.

With the backups, you can experiment without fear.

:)

Sign in to reply to this post

anonymous

I will strongly suggest to do what Tom said as I have learned that lesson the "hard way" way too many times before. :rolleyes:

Sign in to reply to this post

jenkolaka19379118

Thank's Guys,

I will give that a go today, and let you know how I get on

Sign in to reply to this post

jenkolaka19379118

Thank's Guy's

I managed to work out how to get it to display.

Thanks for all your help and time.

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...