?
Solved

error retriving info from function

Posted on 2006-10-28
3
Medium Priority
?
169 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 2000 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.
Suggested Courses

764 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