justuptime.com - monitor your servers & websites

database fields question

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

He has: 107 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
Modrater

He has: 6,148 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';

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...

He has: 107 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?

He has: 107 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