Solved

error retriving info from function

Posted on 2006-10-28
3
164 Views
Last Modified: 2006-11-28
Im completely trying to change the way I original programmed a web application in php and Im expierencing some difficulties

on a certain page for example dealerFunctions.php, I want to have three available tasks all depending on permissions and the button clicked...

if create
if modify
if delete
if view

for any of those functions I call the appropriate function which contains mostly the sql statement

and then I have an includes for the html

because my sql is in the functions Im having troubles bringing the variables back over to appear in the includes file

however if I call function modify with the vehicleId and I echo my query I do get what I want !
0
Comment
Question by:prowebinteractive
  • 2
3 Comments
 
LVL 29

Expert Comment

by:TeRReF
ID: 17826289
If you are dealing with globals, use the $GLOBALS superglobal inside functions...
0
 

Author Comment

by:prowebinteractive
ID: 17826302
please send me an example havent used globals before

Thanks
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 500 total points
ID: 17826361
<?php

// a function
function addBlah() {
        // use $GLOBALS to retrieve the global $string and add blah
        return $GLOBALS['string'].'blah';
}
// if you define a global var here
$string = 'blah';
// add blah to $string
$string = addBlah();
// returns blahblah
echo $string;


?>


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now