General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 19th, 2003, 03:21 AM
timepoint5 timepoint5 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: bayern
Posts: 17 timepoint5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question on "return"

I have a very strange problem.

Based on Ben`s artikel i am building up a small comunty system.
After i did the admin stuff, i wanted to let the users change there own
detailpage.
The idea ist simple:
IF User ist logged in AND pageuserid=userid
a link is been placed to a edit page(which ist secured too ;-) ).

Similar to the admin query i did this:

//-----------------------------------------------------------
function UseridIsDetailId()
{


session_start();

// Check that the session id is valid
$dbVars = new dbVars();

@$svrConn = mysql_connect($dbVars->strServer, $dbVars->strUser, $dbVars->strPass);

if($svrConn)
{
$dbConn = mysql_select_db($dbVars->strDb, $svrConn);

if($dbConn)
{
$strQuery = "SELECT {$this->__FieldNameSess}, {$this->__FieldNameSec}, {$this->__FieldNameUserId} FROM {$this->__StoreSessionTableName} ";
$strQuery .= "WHERE {$this->__FieldNameSess} = '" . session_id() . "' AND {$this->__FieldNameUserId} = '$userid'" ;


$results = @mysql_query($strQuery);

if($result = @mysql_fetch_array($results))
{ return $result{$this->__FieldNameSec}; }
else
{ return 0; }
}
else
{ return false; }
}
else
{ return false; }

}

//________________________________________________
Debuggin the Query gets this:
Array ( [0] => 0082810f7a81847def0077ec0a55d0eb
[sessionid] => 0082810f7a81847def0077ec0a55d0eb
[1] => 1
[auth] => 1
[2] => 27
[userid] => 27 )
//___________________________________________

So als {$this->__FieldNameSec} = auth the funktion should return "1" and i would be happy.
But NO!!


the problem has du be somewere here if($result = @mysql_fetch_array($results))
{ return $result{$this->__FieldNameSec}; }
else
{ return 0; }

//___________________________________________

if i change { return $result{$this->__FieldNameSec}; }
else
{ return 1; }//<-----to that it works, so were is the mistake here:{ return $result{$this->__FieldNameSec}; }

I am workin 2 days on that problem help would be very kind.

Thank you very much
timepoint5

Reply With Quote
  #2  
Old February 23rd, 2003, 01:33 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Are you receiving any error messages at all?

Also, where is "$userid" coming from? Is it entered by the user on a form?
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #3  
Old February 23rd, 2003, 01:59 PM
timepoint5 timepoint5 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: bayern
Posts: 17 timepoint5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
As i didnt find the mistake, ich wrote the funktion on to the page, that worked. So the mistake was calling and debugging a class funktion not in the class.php.

The Userid comes from the funktion that lists all related data to the current userid. Perhaps it could work if i could make that var global, but i dont know how. Anyway its works ok now.
Perhaps i should have dont somethink like $GET['userid'] ...

Greetings timepoint5

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Question on "return"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway