Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
probably a silly problem
Old 02-21-2007, 05:29 AM probably a silly problem
Junior Talker

Posts: 1
Trades: 0
hi guys been wondering over this for a little while and cant figure it out. Basically Im including the file below, where I use a query to extract some data. This file is included in another file and the results returned. This works fine however Im having trouble returning the results and getting a field in this file below.

I can return the results and then get the results in the other file, but not in the same one. So:


PHP Code:
$query111 "SELECT * FROM places WHERE place_id = 5559";    

$result111 mysql_query($query111)
or die (
"The system doesn't like your login details- please try again 
with different ones."
);

$row111 mysql_fetch_assoc($result111);
    
return 
$row111;
$place_id2 $row111['place_id']; 
So I cant return row111 and get something from it. Any ideas?
bigbob2003 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-21-2007, 06:10 PM Re: probably a silly problem
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
What could cause a problem is your return statement.
If this is placed in a function, anything placed after a "return" statement will be left over, as the function exits at the same time it returns something.

If you are not in a function though, I don't see the point of having a return statement...
Could you explain a bit why it's positioned here, and if it's in a function ?

I'm not sure, but if it's in a if or case statement, it could cause the php engine to break out of the condition too, but that's purely a proposition.
I'm not even remotely sure of that.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 02-21-2007 at 06:12 PM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-22-2007, 04:45 AM Re: probably a silly problem
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
tripy,
it's quite a nice point of php. You may return from included file as well as from function. I learned about it not too long ago and sometimes it could be rather useful.

bigbob,
you have an unconditional return from file. It means that exactly this file is not being executed after the "return ..." line. You should rewrite this code in the form of function or whatever.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to probably a silly problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12665 seconds with 12 queries