Jump to content


Photo

Update SQL Statement


  • Please log in to reply
2 replies to this topic

#1 TennesseeGuy

TennesseeGuy
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 05 April 2006 - 08:28 PM

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 :)

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 06 April 2006 - 04:11 AM

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;"

#3 TennesseeGuy

TennesseeGuy
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 08 April 2006 - 08:11 AM

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 :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users