PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old May 11th, 2008, 12:35 PM
mjcondon mjcondon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 114 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 13 m 7 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old May 11th, 2008, 01:11 PM
speedbooster speedbooster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 147 speedbooster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 10 h 37 m 46 sec
Reputation Power: 0
Output mask?

Reply With Quote
  #3  
Old May 11th, 2008, 01:47 PM
mjcondon mjcondon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 114 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 13 m 7 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old May 11th, 2008, 01:51 PM
ryon420's Avatar
ryon420 ryon420 is offline
Oscar Wilde addict
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2006
Location: Was lost, then found, now lost again.
Posts: 2,789 ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)  Folding Points: 1496 Folding Title: Novice Folder
Time spent in forums: 5 Months 1 Week 23 h 5 m 35 sec
Reputation Power: 859
Send a message via MSN to ryon420 Send a message via Google Talk to ryon420
__________________

Warning, the post above may contain extreme sarcasm, crude language, and code that may confuse amateurs and professionals.


Helpful stuff: Google your question first | Read the rules | How to ask a question | Read the [PHP] manual, it is good for you
Proud supporter of: Philosophorum - "where even the trolls are smart" | Chikyu Hakken - digging for trolls
"Programmers usually hate stupid people. But the ironic thing is we spend most of our career developing programs which the stupid people will use" -- Me.


Reply With Quote
  #5  
Old May 11th, 2008, 02:44 PM
mjcondon mjcondon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 114 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 13 m 7 sec
Reputation Power: 0
What is your point?

Why don't you say exactly what your problem is?

Reply With Quote
  #6  
Old May 11th, 2008, 03:28 PM
ryon420's Avatar
ryon420 ryon420 is offline
Oscar Wilde addict
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2006
Location: Was lost, then found, now lost again.
Posts: 2,789 ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)ryon420 User rank is Lieutenant General (80000 - 90000 Reputation Level)  Folding Points: 1496 Folding Title: Novice Folder
Time spent in forums: 5 Months 1 Week 23 h 5 m 35 sec
Reputation Power: 859
Send a message via MSN to ryon420 Send a message via Google Talk to ryon420
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:
I think I should be using a print


Print = echo = the same thing.

Reply With Quote
  #7  
Old May 11th, 2008, 03:50 PM
requinix's Avatar
requinix requinix is offline
requinix|on hiatus
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2007
Location: Here
Posts: 2,459 requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 10713 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 6 Days 3 h 11 m 25 sec
Reputation Power: 386
Send a message via MSN to requinix
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...
__________________
Oyashiro-sama...
If something "isn't working" then EXPLAIN WHY. Tell us what it should do, and then what it does do.

PHP Manual (cURL - PCRE regex - references) error_reporting() SQL injection: and mysql_real_escape_string() PHP and cron
Negative0

Reply With Quote
  #8  
Old May 11th, 2008, 05:01 PM
mjcondon mjcondon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 114 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 13 m 7 sec
Reputation Power: 0
Well why

Why use mysql_data_seek or mysql_fetch_row when I am returning one row?

Reply With Quote
  #9  
Old May 11th, 2008, 05:06 PM
requinix's Avatar
requinix requinix is offline
requinix|on hiatus
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2007
Location: Here
Posts: 2,459 requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)requinix User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 10713 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 6 Days 3 h 11 m 25 sec
Reputation Power: 386
Send a message via MSN to requinix
See, this is why he posted links. So you can read them.

Quote:
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

Quote:
mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array.

You don't (necessarily) need mysql_data_seek(), but you do need one of the mysql_fetch_* functions.
Comments on this post
ryon420 agrees: /me goes off and mumbles quietly into a corner...

Reply With Quote
  #10  
Old May 11th, 2008, 07:12 PM
ptr2void ptr2void is offline
I haz teh codez!
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2003
Location: MA
Posts: 856 ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level)ptr2void User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 51 m 2 sec
Reputation Power: 158
Quote:
Originally Posted by mjcondon
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.


You mean like this?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Masking for output variable?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |