Solved

error retriving info from function

Posted on 2006-10-28
3
163 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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 look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 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

13 Experts available now in Live!

Get 1:1 Help Now