Solved

error retriving info from function

Posted on 2006-10-28
3
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

738 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