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 June 6th, 2003, 03:07 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
functions not working

okay I have never really used functions, so I am not sure how they work altogether, although it seemed sort of self-explainatory when I looked at another page I had with some functions. Alright so I want to do this:

PHP Code:
if($IsLoggedIn)
 {    
  
$strMethod $_GET['strMethod'];
  
$strEditMethod $_GET['strEditMethod'];
    switch(
$strEditMethod)
        {
            case 
"adminEdit":
                
MatchUp();
                break;
            default:
                
NoMatchUp();
                break;
        }
    }

function 
MatchUp()
some stuff }

function 
NoMatchUp()
some other stuff 


But when i use the page, I get:

Fatal error: Call to undefined function: matchup() in c:\...editprofile.php on line 46

which, btw, is a pretty unrelated line of code:

line 42-50:

PHP Code:
<span class="title">Profile Updated!</span></span><br>
<
br>You have successfully updated your Profile!<br>
<
a href="index.php">Continue</a>
<?
php } } } } else { ?>
// this is line 46! it's blank!
<span class="title">Error</span><br><br>
Sorry, but the passwords you supplied did not match. Please use the link below to return.<br><br>
<a href="index.php?page=registration">Back</a>
<?php } } else { 

which is when it goes to the if($isloggedin) part.

So why won't this work? what do I not udnerstand? I have searched and tried lots of stuff. Any help would be great!

Reply With Quote
  #2  
Old June 7th, 2003, 11:23 AM
ApathyBoy ApathyBoy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 3 ApathyBoy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ApathyBoy
Here is a tip i've picked up from debugging many a php application. Whenever you get an error message, take a look at the line just before that one, in this case line 45. A majority of the time, this is where your error will actually be!

I think the problem here is that you have those closing brackets '}' all on the same row. I believe that in php the closing bracket cannot have anything between it and the first of the line.

so get your code to look like this maybe:

PHP Code:
<span class="title">Profile Updated!</span></span><br>
<
br>You have successfully updated your Profile!<br>
<
a href="index.php">Continue</a>
<?
php 



} else { 
?>
// this is line 46! it's blank!
<span class="title">Error</span><br><br>
Sorry, but the passwords you supplied did not match. Please use the link below to return.<br><br>
<a href="index.php?page=registration">Back</a>
<?php 

} else { 


and see if that helps any.

Let me know how that works out for you!

Reply With Quote
  #3  
Old June 9th, 2003, 03:05 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
new problem

okay so I decided to move the functions towards the beginning and move the switch to the end, and that solved it. I guess functions have to be declared before they are used. makes sense but i thought I saw it somewhere else done differently, maybe they were declared anyway oh well.
so now there is a new problem. I want to make an admin section where admins can edit any profile of any user. I have done this using the little article about the <<prev 1 2 3 next >> thing. But i think i dont understand the whole template thing. Well my editprofile page looks like this:

it grabs the loggedin users sessionid and compares it to that of the users in the database, to retrieve that users information to be edited. this works fine for one person.

But then my admin-main-edit page works like this:

it grabs info from the users database not the session database, and I can not figure out how to grab from both using the template.

so i decided that I would simply create a new $variable, use it to determine the user that was called on in the users database, compare that users info to the session database, so that it can simply get the right sessid and then call on the user info like it normally does.

i hope tha made sense. at any rate the problem lies here:

PHP Code:
function MatchUp()
       {
         
$changeIt = @mysql_query("SELECT * FROM users WHERE userId ='" $strMethod "'") or die ("couldn't do it");
          while (
$changeRow mysql_fetch_row($changeIt))
              { 
$changeIt2 = @mysql_query("SELECT * FROM `session` WHERE username = '" $changeRow[1] . "'") or die ("couldn't do this");
                while (
$changeRow2 mysql_fetch_row($changeIt2))
                 {     
$strMethod2 $changeRow2[1]; } }
                    
header("Location: index.php?page=editprofile&strMethod=$strMethod2"); 


but this is returning nothing in my url for $strMethod2. I tried this cause i thought it was how was suppossed to be written:

PHP Code:
("Location: index.php?page=editprofile&strMethod='" $strMethod2 "'"); 

which returned:
index.php?page=editprofile&strMethod=''
it seems to be giving me an empty string for the variable.

i hopes this makes sense. anyone with help would be awesome. thanx.

Reply With Quote
  #4  
Old June 12th, 2003, 09:33 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
i will move this to a new thread

i will make this a new thread

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > functions not working


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 5 hosted by Hostway