database fields question

They have: 105 posts

Joined: Mar 2006

I get the following error, is this because I am trying to get data for a row using a field that is not the primary key? for example,

messageId, UserTo, UserFrom, Message
11293, user1, user2, Hello

I get this error when I try and get all the messages for the user that is logged in so I use the following to read the messages readmessages.asp?user=userto (I am refering to the userto field in the database, because I want to get all the messages that have been sent to that user.

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[MySQL][ODBC 3.51 Driver][mysqld-4.1.15-standard]Table 'nwicorgu.message' doesn't exist

readmessages.asp, line 160

Busy's picture

He has: 6,151 posts

Joined: May 2001

Is Message 11293 one field or you just missed out a comma?

The error is saying the message field doesn't exist, can you give us the query your using, should be something like:

Select message from databasetable where UserTo='user';

They have: 105 posts

Joined: Mar 2006

the messageId 478473 is just an example because it is an int, I think the SQL query is something like

SELECT * FROM messages WHERE userto =

<?php
username
?>

MessageId:

<?php
=rs("messageId")
?>

To:
<?php
=rs("userto")
?>

From:
<?php
=rs("userfrom")
?>

Message:
<?php
=rs("message")

<%
username
?>
is a cookie that contains the current logged in user, which is used to get the data from the messages database for userto, since the logged in user wants to get messages that have been sent to them. Would this work because it is not refering to the primary key which is the MessageId?

They have: 105 posts

Joined: Mar 2006

I think I know why it doesn't work! It's refering to a table called message in the asp, and the actual table name is messages Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.