Jump to content

Recommended Posts

I have a database of books that users can add to, and one of the fields is the number of volumes they have (it's currently set to varchar in the database). I want other users to be able to search for specific volumes if they want, but if someone has volumes 1-18, they won't type it as 1,2,3,4 etc etc. How can I search the range of volumes without having to type out every number in between? I'm kinda new to PHP. Can I do this through PHP, or do I need to use javascript, or something in the mySQL code? I have no idea!

 

What I want, essentially, is if the user searches for vol 7, and one of the volumes field in the database has 1-9 as its value, it will recognize that 1-9 means that they do have vol 7.

Looks like poor DB design to me. You should read up on structuring it better.

 

If a user has only one volume, then I'm guessing the DB would have it as 5 instead of 5-5, right? And what if a user has volumes 1-3 and volume 5. It's too random for someone to write a SQL for that. Work on DB design.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.