473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

MySQL, How to add values for SMALLINT? And Than How to filter by value?

ilya Kraft
134 100+
Hello,

For my moderation system I need following field in database table:

name: Showing
type: smallint
values: '0','1'

I tried entering '0','1' in the values of field in smallint, but it doesn't work. What is correct way to enter 0 and 1 for values in small int?

and then how can I filter content to the page. for example

if "showing" = 0 than show content on page, else show nothing.

Thank YOu )))))
May 21 '11 #1

✓ answered by nathj

Hi,

I thought we were working on this discussion on a different thread

As I ahve pointed out there before you need to pass integers in which don't use ' as Dormlich has pointed out.

Dormlich is right in saying you could use a if() condition once you have all the results or you could add to the where clause of the query that returns the results.

Expand|Select|Wrap|Line Numbers
  1. select a.col1, a.col2, a.col3
  2. from table a
  3. where a.col4 = 1
  4.  
Assuming col4 is the field that is smallint or tinyint as was originally suggested.

Hope this helps you out.
Nathj

4 2291
Dormilich
8,658 Expert Mod 8TB
I tried entering '0','1' in the values of field in smallint, but it doesn't work.
obviously, those values are strings, not integers. (integers are passed without ')
May 22 '11 #2
ilya Kraft
134 100+
Oh alright )))

so for values I only put 0,1 right?
And by any chance do you know php statement that will allow to show content if it's set to 1 and not show if it's set to 0 ?

Thnx )))
May 22 '11 #3
Dormilich
8,658 Expert Mod 8TB
a standard if() condition.
May 22 '11 #4
nathj
938 Expert 512MB
Hi,

I thought we were working on this discussion on a different thread

As I ahve pointed out there before you need to pass integers in which don't use ' as Dormlich has pointed out.

Dormlich is right in saying you could use a if() condition once you have all the results or you could add to the where clause of the query that returns the results.

Expand|Select|Wrap|Line Numbers
  1. select a.col1, a.col2, a.col3
  2. from table a
  3. where a.col4 = 1
  4.  
Assuming col4 is the field that is smallint or tinyint as was originally suggested.

Hope this helps you out.
Nathj
May 23 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Rod | last post by:
I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET Last week an error appeared related to the...
20
by: MLH | last post by:
120 MyString = "How many copies of each letter do you need?" 150 MyVariant = InputBox(MyString, "How Many?", "3") If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'" If...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
4
by: Military Smurf | last post by:
I'm interested in writing a web service that will return more than one value. What's the best way to accomplish this? I was wondering if an array would be best, but I'd like to know if there is a...
7
by: The87Boy | last post by:
Is there any ways to make a function like system(), which returns more than one value (true or false) and (the array)
5
by: tirumalab | last post by:
Hi all, How can we catch the return values if the function, which takes out parameters, is going to return more than one value in C#. Ex: public int addparams(out int x,out int y) ...
1
by: Aleck | last post by:
Hie. I have a trigger that monitors changes to my table fields but I get an error saying subquery returned more than one value.Below is the code for my trigger, hope you will figure out whats...
4
by: Jonathan | last post by:
I have a SQL stored procedure for adding a new record in a transactions table. It also has two return values: CounterID and IDKey. I want to create a webservice that accepts the 10 input...
1
by: Rajava | last post by:
SELECT pmc_sales1."documentno" AS documentno, pmc_sales1."aj_date" AS date, pmc_sales1."aj_ordno" AS ordno, pmc_sales1."aj_total" AS total, pmc_sales1."aj_tax" AS tax, ...
1
by: varunkumarid | last post by:
Hi to everybody How to Store More then one values(ie., Divids) at Same Cookie name in JavaScript? Or is there any methodology to kept more than one value at Cookie in Javascript?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.