Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-19-2006, 04:54 PM   PM User | #1
THM
New Coder

 
Join Date: Jun 2006
Location: Philladelphia
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
THM is an unknown quantity at this point
calling on a mysql query & session through php

PHP Code:
$checkclass $db_object->query("SELECT class FROM table_a WHERE username = '".$_SESSION['username']."'"); 
I am trying to call on a table from my mysql database, and tell it to use the current session's username to pull out the users class. It won't work though. Whenever I call on $checkclass it says Object, and thats all.

Any help would be greatly appreciated
THM is offline   Reply With Quote
Old 11-19-2006, 07:13 PM   PM User | #2
ess
Regular Coder

 
Join Date: Oct 2006
Location: United Kingdom
Posts: 865
Thanks: 7
Thanked 29 Times in 28 Posts
ess will become famous soon enough
To narrow down the problem, try and echo out the value of $_SESSION['username'];

Check that the value exists in the database,

Also, I think when you execute the query statement, the returned value is a resource or an object. for example,

// result is of type resource
$result = mysql_query( $sql );
// to do anything with the result, we need to obtain values
// by using the following
while( $row = mysql_fetch_array( $result ) ) {
// obtain data from array $row.
}


good luck.
Ess
ess is offline   Reply With Quote
Old 11-19-2006, 09:53 PM   PM User | #3
THM
New Coder

 
Join Date: Jun 2006
Location: Philladelphia
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
THM is an unknown quantity at this point
The value does exist. I'm going to try and do what you said, but I'm not fully understanding it..
THM is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:05 PM.


Advertisement
Log in to turn off these ads.