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:
  #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: 119 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 52 m 15 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: 187 speedbooster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 50 m 53 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: 119 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 52 m 15 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
Comp. Sci. version of Dr House
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2006
Location: Was lost, then found, now lost again.
Posts: 3,744 ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 1496 Folding Title: Novice Folder
Time spent in forums: 7 Months 3 Weeks 4 Days 9 h 57 m 57 sec
Reputation Power: 1908
Send a message via MSN to ryon420 Send a message via Google Talk to ryon420
__________________
"And what, Socrates, is the food of the soul?

Surely, I said, knowledge is the food of the soul." -- Plato

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: 119 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 52 m 15 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
Comp. Sci. version of Dr House
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2006
Location: Was lost, then found, now lost again.
Posts: 3,744 ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 1496 Folding Title: Novice Folder
Time spent in forums: 7 Months 3 Weeks 4 Days 9 h 57 m 57 sec
Reputation Power: 1908
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
No strings attached
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 4,627 requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 77202 Folding Title: Intermediate FolderFolding Points: 77202 Folding Title: Intermediate FolderFolding Points: 77202 Folding Title: Intermediate FolderFolding Points: 77202 Folding Title: Intermediate Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 20 h 51 m 36 sec
Reputation Power: 1898
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...
__________________
How to ask a question

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: 119 mjcondon Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 52 m 15 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
No strings attached
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 4,627 requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)requinix User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 77202 Folding Title: Intermediate FolderFolding Points: 77202 Folding Title: Intermediate FolderFolding Points: 77202 Folding Title: Intermediate FolderFolding Points: 77202 Folding Title: Intermediate Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 20 h 51 m 36 sec
Reputation Power: 1898
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 Beginner (1000 - 1499 posts)
 
Join Date: Dec 2003
Posts: 1,231 ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level)ptr2void User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 4 Weeks 18 m 8 sec
Reputation Power: 587
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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT