User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 422,412 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,052 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 382 | Replies: 1 | Solved
Reply
Join Date: Feb 2008
Posts: 297
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

help needed!

  #1  
Jun 2nd, 2008
i have created a table to store the number of a count which i need for some subtraction at a later date. when i try to get the information out of the table instead of getting the number 5 i am getting resource id # 5.

the table has been set up like this

$sql="CREATE TABLE IF NOT EXISTS `email_count` (
			
			`id` INT NOT NULL AUTO_INCREMENT,
			`sent_messages` INT not null,
			primary key (id)
		)";
		mysql_query($sql) or die (mysql_error());

selecting the information out of the table looks like this

$query = "SELECT sent_messages FROM email_count";
$result=mysql_query($query)or die(mysql_error());
$sent_mail = $results;

how can i get it to just display the number?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Posts: 297
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: help needed!

  #2  
Jun 2nd, 2008
i got the code working using this

$query = "SELECT sent_messages FROM email_count"or die(mysql_error());
$results = mysql_query($query);
$arr = mysql_fetch_array($results);
$sent_mail = $arr[0];
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 9:29 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC