close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Trying to join the order table and order detail together on the detail page

Thread began 2/03/2010 11:50 am by sturgisk383938 | Last modified 2/04/2010 9:51 am by Mustapha307688 | 1853 views | 3 replies |

sturgisk383938

Trying to join the order table and order detail together on the detail page

I trying to create an order history and detail page to my site. When I test the pages I can get the history page to display information but when I click the link to see the detail page. I get an sql sytax error was is, You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server version for the right syntax to use near 'FROM orders INNER JOIN -1 ON orders.OrdersID = -1.DetailOrdersID WHERE -1.DetailO' at line 1.


I have followed the instruction posted on your web site regarding how to create an order history page. I tried to change the WADAorderdetails server behavior for the detail page.

I entered the code to join the orders and ordersdetails tables as follows:
SELECT orders.*, orderdetails.*
FROM orders INNER JOIN orderdetails ON orders.OrderID = orderdetails.DetailsOrderID
WHERE orderdetails.DetailOrderID = WADAOrderID AND order.OrderUserID = paramUserID


I did add the variable parameter paramUserID. My question is for the first variable parameter was colname. What should the first variable name be? What did I do wrong?

Help?

Sign in to reply to this post

Jason ByrnesWebAssist

judging by the error, it looks one of the parameters you created was named "orderdetails"



when naming a parameter, I always preface the name with "param", for example, "paramOrderdetails"

Sign in to reply to this post

sturgisk383938

still having problems with the history page and detail page

I have read the how to create an order history page several times and retrace my steps.
I am still having problems with this. My problems is customize the order detail page. According to the direction the Server Behaviors WADAorderdetails needs to be change.

I have modified the entire SQL statement. I also add another variable parameter for paramUserID. My questions is what should be the first parameter when you modified the SQL statement. I am confused regarding this. The SQL statement looks like this:

SELECT orders.*, orderdetails.*
FROM orders INNER JOIN orderdetails ON orders.OrderID = orderdetails.Details.Details.DetailOrderID
WHERE orderdetails.DetailsOrderID = WADAOrderID and order.OrderUserID = paramUserID

This is in the how to create an order history tutorial. I also have applied the Login/Registration as well. What should I do next? I really want this to be part of the site.

Sign in to reply to this post

Mustapha307688

Join statement might not be correct !

Hi there

I am asuming you are using dreamweaver and you are connecting to a mysql database.

i do not know what you database erd and structure looks like but looking at your join statement I noticed this:

"SELECT orders.*, orderdetails.*
FROM orders INNER JOIN orderdetails ON orders.OrderID = orderdetails.DetailsOrderID"

1. You joining primary Key with primary key of another table !Wrong !
2. I think you should try to clean up your statement to look like this below.

Select * from Orders INNER JOIN OrderDetails ON
orders.OrderID = orderdetails.OrderID (you could also leave out INNER for now)

Leave out the where clause for now just to get your join to work !!!

Now what I would reccomend is open dreamweaver ...

1. Create a connection.
2. Create a recordset and in the dialogue copy and paste the join statement that I gave you ***INTO THE SQL TEXT BOX THAT IS THERE ***and click test ! If it works then you will actually see all the fields in both tables ...! Else it will tell you that you have a syntax error.

If that is the case I suggest you examine your ERD carefully to see that the PK OrderId is actullay refencing the OrderDetails Table as ForeignKey !

I hope this will be of some help !!! Let me know !
Mustapha

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