TennesseeGuy Posted April 5, 2006 Share Posted April 5, 2006 Simple question for you gods of mysql. I have a simple upload include script within one of my pages. the include script is only called upon if certain criteria are met. If those criteria are met then the script process normally. The images are uploaded to the appropriate folder and the original is trashed from the temp folder. My question is how on the parent page can I extract the new file name (upload script has a unique renaming script) so I may include it in my insert into statement? Thanks all :) Quote Link to comment https://forums.phpfreaks.com/topic/6680-update-sql-statement/ Share on other sites More sharing options...
wickning1 Posted April 6, 2006 Share Posted April 6, 2006 Not really a MySQL question, but of course I'll answer anyway.The clean way to do something like that is to make the upload handler in the included file a function, and have it return the new filename. That way your scoping all works out. You can also use a global variable, the included file sets it, the calling file checks its value later. The "global" construct can be used to bring it into scope. i.e. "global $cfg; echo $cfg;" Quote Link to comment https://forums.phpfreaks.com/topic/6680-update-sql-statement/#findComment-24367 Share on other sites More sharing options...
TennesseeGuy Posted April 8, 2006 Author Share Posted April 8, 2006 Thanks wick. The global vaiable worked perfectly. I was trying th return before but it wasn't working until I made it global. Thanks for your help :) Quote Link to comment https://forums.phpfreaks.com/topic/6680-update-sql-statement/#findComment-24972 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.