Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:31:13+00:00 2026-05-16T18:31:13+00:00

The reason for a second sentence in my question as it can hold any

  • 0

The reason for a second sentence in my
question ” as it can hold any datatype
as string.” is to make the question
more specific from the view of it so
that people will really get the actual
picture before going to the answers.

i have asked this question after posting and getting responses to this question.
according to those responses i have planned to do it this way. i am just mentioning it here and if you have time then you can go through. because this current question has been raised after that.

the current quesiton is as follows…

  1. I am having a field with varchar datatype.
  2. by default it is null.
  3. it will hold either null or string(which is the filename of an image) or the timestamp value of the time when that image was uploaded.
  4. If it is null or if it is the integer value of timestamp value then i want display no-image.jpg.
  5. if it is a string then it is the actual image so i will display that image.
  6. if the field holds null datatype then no image has been uploaded.
  7. if it is a timestamp value then the users is still manipulating his uploaded image.
  8. if it is a string then that is the actual image which is ready to be displayed.
  9. uploads are done by only one person.

so, i am executing a query and in that i want to find whether the varchar value is null or integer or a string.

i dont want to do more calculation in php. i hope there should be an option in sql to do that.

if you feel you would like to give both the answers (by solving it in sql or by solving it in php) then that is too fine.

here is what i have planned to do in php.

$val = $rs['filename'];
if(is_null($val)) // display a noimage.jpg
else if(is_numeric($val)) // display a noimage.jpg
else // display the actual image.

what i expect in sql is to call a function and if null or integer then i will use the as keyword and ‘noimage.jpg’ else as the actual image…

select somefunction(filename) as something….
the something should hold noimage.jpg if the value is null or integer.
if the value is a string then it should hold the actualimagename.

hope i have made it clear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:31:13+00:00Added an answer on May 16, 2026 at 6:31 pm

    Why not add another column to the table to specify what this field is? Not to say this would make what sounds like a very bad design any better, but it would be safer than trying to figure out what you stored in the first place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The reason I ask is that Stack Overflow has been Slashdotted , and Redditted
The reason for me asking this question is:- I get a real buzz out
Is there any reason not to use the bitwise operators &, |, and ^
For whatever reason, our company has a coding guideline that states: Each class shall
For some reason when I attempt to make a request to an Ajax.net web
1) One reason to use encapsulation is that by hidding internal implementation details we
So, for some strange reason I end up with a 100GB log file that
For some reason when you mouse over either menu item, only the second one
For some reason, the first method doesn't display anything, while the second does: //Common
the second unpacking is not working with print, what is the reason? for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.