|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Masking for output variable?
I have a table defined in MySQL with Votes defined as Bigint.
1st of all, wjat is the limit of integer INT, and 2nd of all how can I put an "output mask" on $result['Votes'] shwon below: $result = mysql_query("select Name, Votes from election where Name='JohnDoe'"); echo "Votes so far: ", $result['Votes']; Thanks in advance. ![]() |
|
#2
|
|||
|
|||
|
Output mask?
|
|
#3
|
|||
|
|||
|
Yes,
Output mask is perhaps a bit Old School. Instead of just an echo, I think I should be using a print or sprint instead - the rub is getting the number formatted in integer format #,###,###,### (where the #'s would mask the leading zeroes). So I guess this is a bit more to the point.
|
|
#4
|
||||
|
||||
|
__________________
"And what, Socrates, is the food of the soul? Surely, I said, knowledge is the food of the soul." -- Plato |
|
#5
|
|||
|
|||
|
What is your point?
Why don't you say exactly what your problem is?
|
|
#6
|
||||
|
||||
|
Me? My problem? Oh, my problem is people asking questions before googling. Anyway, the code you posted above wouldn't work so I posted links to explain why.
Anyway, as for your questions: INT usually holds from -128 to 127 signed and 0 to 255 unsigned. And as for "where the #'s would mask the leading zeroes" do you mean ZEROFILL? I'm confused by your question. Quote:
Print = echo = the same thing. |
|
#7
|
||||
|
||||
|
PHP's integer or MySQL's integer? And is it INT or BIGINT?
PHP's is system-dependant: look at the constant PHP_INT_MAX. INT is 32-bit: signed +/-2.1 billion (-2^31 to 2^31-1), unsigned up to 4.3 billion (0 to 2^32-1). BIGINT is 64-bit: signed +/-9.2 million billion (-2^63 to 2^63-1), unsigned up to 18.4 million billion (0 to 2^64-1). Also...
__________________
How to ask a question |
|
#8
|
|||
|
|||
|
Well why
Why use mysql_data_seek or mysql_fetch_row when I am returning one row?
|
|
#9
|
||||
|
||||
|
See, this is why he posted links. So you can read them.
Quote:
Quote:
You don't (necessarily) need mysql_data_seek(), but you do need one of the mysql_fetch_* functions. |
|
#10
|
|||
|
|||
|
Quote:
You mean like this? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Masking for output variable? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|