How Could I Get Numbers From A Mysql Database And Add Them Up
how could I get numbers from a mysql database and add them up(if possible)?
Like using a id from a different table and then for each id entry in the first(not the different) table adding the numbers.
View Complete Forum Thread with Replies
Related Forum Messages:
Database With Numbers
I have a items listed in a database with numbers ... 1, 2, 3 some are like 4a and 4b. but my issue of course, is that I want them to appear: 8, 9, 10, 11 and not 1, 10, 11, 12 ... 2, 20, 21, 22 ... These numbers are in a varchar field in the database to allow for the Ɗa' and Ɗb' issues ... how can I re-order the rows in my query to come back so that the number 4 comes before 10 ?
View Replies !
Scheduling - Update The Numbers In Database
I am trying to make a script that will update the numbers in my database depending on how long the script was in use. For example if the number 50 is in the database and the script is run. If it is run for 10 minutes i want the number to change to 100. If it was only run for 5 mins it should only be increased by 25. Can this be done? If so how would I go about doing this?
View Replies !
Sorting Database Results Values As Numbers
I've got a slight problem with a query that I am processing, they query is as follows "select * from categories order by categoryident" categoryident is a "char" field, and ordering by it is fine, however, the information in the field is in the form of 1 1.1 1.2 2 2.3 etc etc So logically it should order as i have shown above... however, when I get to 10 and up. it orders it like this. 1 1.1 1.2 11 11.1 11.2 2 2.3 etc etc how do i get it to treat those values as numbers so that it will order numerically, I can't change the field it a "float" because some of the entries have text in them.
View Replies !
MySQL SUM() With Big Numbers.
I have a large database, and am counting the contents of a particular column covering every record (some numbers have a decimal place, they are stored as TINYTEXT - (there was a reason at the time... ). I am using SUM( ) to add them all up, it was working fine untill a few days ago when it started reeturning an exponential, i.e. 9.88E16 I was then advised to use printf("%f", $var); which made the number slightly more readable. The problem now is that is displays a rediculously large number! Nothing like what is expected.
View Replies !
MySQL: Select Row Numbers
I would like to be able to do something like this... select name,dob from employees where [rownum] > 10 and [rownum] < 20; .... results from this would show me data from the 10th, 11th,... and 19th row.
View Replies !
Numbers Being Stored In Mysql
I have a column that contains floats (exp 2.2, 3.4 etc.) What type of column should it be? varchar will not order them properly and integer converts them to round numbers.
View Replies !
Sum A Set Of Numbers From An Mysql Query
I keep getting resource ID #2 when trying to run this code: $link=mysql_connect("localhost", "myuser", "mypass"); mysql_selectdb("radius"); $sumtime = mysql_query("SELECT SUM(sessiontime) FROM accounting WHERE 1 AND UserName='annsflorist' AND date > 񟭄-11-29' AND date < 񟭄-12-01' AND SessionTime > 0"); echo $sumtime;
View Replies !
Randomised Numbers Inserted In MySql
I would like a script that takes a base number of 100 and randomises it into 18 numbers (range of 0-10) which all add up to the 100. Whole numbers please. Examples: 4,7,9,2,1,6,5,8,10,1,7,3,8,7,2,7,4,9 == 100 7,3,8,7,2,7,4,9,1,10,8,5,6,1,2,9,7,4 == 100 I have no idea on how to create this, anyone have a script or ideas on the code? The random numbers will fill in fields on a player charactor statistics. The player will have stats, which at the start of the game will be filled in by random numbers. The user will have the option to reroll and the stats will be filled in my different numbers. Once they are happy, they click OK and the numbers are inserted into a database in different fields. 1. The Base Number is the total of the 18 variables, meaning all 18 have to addup to 100. 2. The numbers can be reused as many times as needed. 3. Numbers that are left over have to be added to the variables to make the total equal 100. 4. 0 is not really necessary, so the variables have to be 1-10 5. The idea is the player will click a button which will populate the fields, if the player wants to 'reroll' he clicks the button again and the fields get populated with different numbers.
View Replies !
Grab A Column Of Phone Numbers From Mysql Table
Im trying to grab a column of phone numbers from mysql table, send all the records across a hidden form field along with a message text area and reply field.once submitted grab all the records from the phone number column and format it to: $mobile = '12345,456788,566788,etc'; also grab the message post and reply post data Basically so I can send a the same message to all the mobiles.
View Replies !
Random Numbers Being Created But All The Numbers Have To Be Different
I want four random numbers being created but all the numbers have to be different. For example: no 1,2,2,4 or 4,3,1,1, etc... For example a right result would be 3,4,1,2. So no double numbers. PHP Code:
View Replies !
Create A Multi Table Database In MySQL And Write To And Retrieve Information Using MySQL.
I am trying to create a multi table database in MySQL and write to and retrieve information using MySQL. I am able to insert and call data easily enough going into one table, but I am having problems with connecting tables and using the idea of normalization. I am starting simple with an online registration for alumni of an association. My first table in a database is called alumni and it stores there e-mail address, first and last name and year of graduation. Code:
View Replies !
Removing Numbers From A Set Of Numbers
Say theres a limit of number choices from 1 to 10. (not including 0) Now these numbers are buyable so say some one buys number 7. With a query or what ever is needed i need to find a way for the screen to then display: 1 2 3 4 5 6 8 9 10. As you notice 7 is not missing.. but it could be any number and more than one number that has already been taken... How can this be done in PHP and MYSQL or will it require some other script?
View Replies !
And Mysql - Connect Remotely To A Mysql Database.
I am trying to connect remotely to a mysql database. here is the code: <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_myDB = "http://db195.perfora.net"; $database_myDB = "dbname"; $username_myDB = "username"; $password_myDB = "password"; $myDB = mysql_pconnect($hostname_myDB, $username_myDB, $password_myDB) or trigger_error(mysql_error(),E_USER_ERROR); ?> here is the error: Warning: mysql_pconnect(): Unknown MySQL Server Host 'db195.perfora.net' (1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9
View Replies !
Copy And Paste On MySQL To MySQL Database
Would there be any issues if i literary Copy and Paste a mysql db from one server to another mysql db server? When i say "copy and paste" is just like tranferring one word doc from one pc to another pc. I tried the copy and paste already and the new server had recognize the DB i had pasted. I just want to confirm if there would be issues doing it so.. Or should i use Mysql.com Migration toolkit?
View Replies !
Php/Mysql- Uploading Mysql Database
I've set up a basic database using Mysql (just creating a web blog I followed a tutorial) and then started writing the php code for interacting with the database. how do I put the Mysql database onto the the web server where I have server space (the server I use is just some company that I pay €100 a year for). I need the php file to get the data from the Mysql database...
View Replies !
Getting A Value From MYSQl Database
I want to get the value from a field in the database using the following PHP code: $sql = "SELECT Paper_id from Papers WHERE Title= '$Paper_Title'"; $PaperID = mysql_query($sql); However this returns some wierd response: "Resource id #2" how do I just get the value of the field in my new selected table which is 1*1.
View Replies !
Get A VB Database Into Like MySQL
I have a database (.mdb) made through Visual Basic. I want to have the information in that database availible for PHP on my site. Any ideas on how I could get this to work? Ive heard that there is no way to get a VB database into like MySQL so does anybody else know another way?
View Replies !
MySQL Database With PHP
First i don't have lots of expreince in sql statements, the worst i have less experience in performance issues in sql databases. I have a mysql db as stated in title. it has a table and 4 fields like these: artist VARCHAR(255) album VARCHAR(255) song VARCHAR(255) lyrics LONGTEXT // :( as you understood first three fields is not problam at all but the last field contains song lyrics. i am about to put 60.000 records to this table and it will be about 100MB in size. on my localhost i have put around 30.000 records and doing some speed test on it. my statements are like this: "Select artist From lyrics Group By artist Having artist Like 'a%' Order By artist Limit 0, 30" it seems a little slow to me. i think it may change litle bit in my internet hosting cos they will probably have more stable servers running linux machines then me running mysql on a windows machine.
View Replies !
Get A MySQL Database
I need a MySql database for my website. I have been unsuccessful in any attempt to log in to MySql via telnet and my e-mail messages to support have gone unanswered. How do I get a database established?
View Replies !
MySQL / Database / PHP
I plan to set up "reader comments" on my pages, and have a little book called something like "PHP in easy steps" that has an example. One thing I am not sure of is, once a comment has been published, can it simply be modified by finding the item on the database and changing it / deleting it? I guess ideally each comment should be moderated before being published, but that seems to be more complicated for me right now. Also, is it easy (ish) to set up comments on many pages? e.g. I have about 100 "articles" pages that I would like to add comments to. Can this be set up automatically, with a simple bit of code, or woul each page have to be linked to the database? I really am a newbie! Look forward to your advice.
View Replies !
Mysql Database
is it possible to update multible mysql database with one database is localhost(backup) and the 2nd one is the online one. so my code is like this: mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $query = (insert query here) mysql_query($query) or die(mysql_error()); mysql_connect("somehere.com", "username", "password") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $query1 = (insert query here) mysql_query($query1) or die(mysql_error());
View Replies !
Help With MySQL Database Retrieval
I am a total newbie and I am having problems retrieving multiple rows from a database... when I try to get a printout of the whole table, I get the following error: Warning: 0 is not a MySQL result index in C:HTTPDHTDOCStest.php3 My code is as follows: <?php $db = mysql_connect("localhost", "root"); mysql_select_db("test",$db); if ($myrow = mysql_fetch_array($result)) { echo "<table border=1>n"; echo "<tr><td>Name</td><td>Position</td></tr>n"; do { printf("<tr><td>%s %s</td><td>%s</tr>n", $myrow["first"], $myrow["last"], $myrow["address"]); } while ($myrow = mysql_fetch_array($result)); echo "</table>n"; } else { echo "Sorry, no records were found!"; } ?>
View Replies !
Pdf Files In A Mysql Database
I have a mysql database which I reach with php-code. I want to be able to download and open files I have stored(as a BLOB) in the database. Downloading and opening word documents and textfiles give no problems, but PDF-files aren't possible to open. Has anybody the same troubles, or does anybody know a solution for this problem?
View Replies !
Insert Into Mysql Database
It sounds very simple, but for some reason I just can't figure it out, and it will save a lots of time to me, if someone can direct me into the right direction. I was trying to input data into mysql table through post method, but it was not working. I made it simple and just tried to enter anything from a php file, but it does not work, so there is something that i am doing wrong with the insertion query. $link = mysql_connect($hostName, $userName, $password); echo("connected"); mysql_select_db($databaseName, $link); echo("database selected"); echo ($databaseName); mysql_query("INSERT INTO image VALES('','','','','','','','','', 'hello', '', '', '','','','','')", $link); echo ("done"); I am trying to enter into one of those fields, but it does not populate the table in mysql database.
View Replies !
Cant Connect To Mysql Database
I'm having a problem connecting to a database, when i use the following script to connect to a database (all the login details are correct) it connects to mysql but says it can't connect to the database any body got any suggestions...
View Replies !
Creating A New MySQL Database
I run a small horse racing based website that has a 'fantasy league' type competition each season. Last year i looked after all the entries, leaderboards etc.. using excel and copying and pasting to webpages each week. However this year i am going to attempt to use MySQL and PHP to have it automatic bar result entry. I have built a basic php and MySQL site before with the usual insert, edit etc.. But this one will need features im not sure how i go about making. Basically there will be a list of horses (around 150) divided into 4 grades. Entrants pick 2 horses from each grade so a total of 8 horses. Winning horses score 5, 2nd = 3 and 3rd =1. I was thinking of having the following 2 tables - one for the horses - listing their name and grade. One for entrants - the peoples contact details and their chosen horses. However from there im not sure how to able to enter the latest results and how i can create a leaderboard page and list the points each horse has. I was thinking of a new table with a row for each result showing horse name and points scored but i then dont't know how this table can be used to create a column on the horse table that lists each horses total points. And also how it can be used to create the total points each entranant has got so far (i.e. the total point for all 8 of their horses)
View Replies !
Mysql Database Problem
I installed php4,MySQL,Apache on my Windows98 system. Everything works up to the point of connecting to Mysql. Then I can't get it to do anything else. this works to connect: $connection = mysql_connect("localhost", "user", "xxxxxxxx") or die ("couldn't connect"); if ($connection) { $msg = "success!";}?> But when I try to anything like create a database I get the errors (in this case 'couldn't create database'.) <? $new_db = "cosmos"; $connection = @mysql_connect("localhost", "user", "xxxxxxxxx") or die ("Couldn't connect."); $result = @mysql_create_db($new_db,$connection) or die ("Couldn't create database"); if ($result) {$msg = "<p>Database has been created</p>";}?>
View Replies !
Create Mysql Database?
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All the tutorials I can find seem to bypass the issue by ignoring it?
View Replies !
Copying From One Mysql Database To Another
Is it possible to open a connection to two separate mysql databases in order to copy the data from one table in the first database into a table in the second database? I'm assuming the answer is yes, but I'm confused as to the proper php syntax.
View Replies !
How I Setup My Mysql Database(s)...
Quick question on how I setup my mysql database(s)... If my setup is such that I have multiple clients, and each client gets 10 tables to store their data, is it better for performance if I put all of these tables into 1 large database (with a unique identifier prepended to each one) or create a separate database for each client? i.e., assuming 1000 clients, I either would have: A) 1 database and 10,000 tables in it, 10,000 total tables B) 1000 databases with 10 tables in each, 10,000 total tables Intuition tells me that the multiple databases would be better for isolating data between clients, but I am not sure if this would slow things down. All the info I found on this online was inconclusive and mostly was people speculating, so I hoped you all could help more.
View Replies !
MySQL Country Database
Is there anyone out there willing to donate their country table fora web database. I have been looking all over for a sql script to create a country table populated with recent data, but I just can't seem to find one. People must do this ALL the time.
View Replies !
Parsing PHP From A MySQL Database
i am creating a CMS and i have a setup so you can add sections and they get stored in a db then you can call them with index.php/section. however this doesn't work right if you have PHP in the content of the section. the PHP code shows up instead of getting parsed. PHP Code:
View Replies !
XML Datas To MySQL Database
Where to find a comprehensive document on how take datas from XML and put them in a Mysql Database. I've many sites sending us XML files. We have to parse datas and save those datas on Mysql. The problem is that we have many different file format (each company sends us it's own XML structure). How to provide a simple way to get those datas in Mysql, without having to create a new PHP script for every new site's XML ?
View Replies !
Poll Without A MySQL Database
I'm trying to create a poll that uses a simple *.txt file as a "database". And I'm wondering how to do the following things: 1) How to open the *.txt file; 2) How to list each answer-option; 3) How to add 1 to the selected asnwer-option; 4) How to save the data to the *.txt again; 5) How to close the file.
View Replies !
MySQL Database Backup
I'm looking at using PHP and MySQL for a particular website application. However, I was a bit concerned that if a PHP script went wrong then it would be possible to accidentally delete or overwrite large chunks of the data in the database which presumably would then be lost. What is the usual procedure for these situations?. Is it possible to back up a database somehow so that data from a previous time can be retrieved?.
View Replies !
|