views:

106

answers:

1

ok im new on the scene with php and sql, i read the basics and was able to produce a DB driven shoutbox. This is my website http://www.teamdelta.byethost12.com/

What i want to do next im not sure what i should be using java? php? sql? i have no idea... but i assume php and sql if sql can do what i think it can.. What i want to do next is to A extract data from data at certain positions for example

data in the format "DAB:CD:EF:GH" eg "D03:57:16:23" to be turned into AB, DF, CE. Eg "3","76","51". then i want to store these Numbers (Not VARCHARS) in the database.

that is part 1.

the sceond part that i want to make sure is possible before i put to much effort in is to do calculations on all the entries in the database with respect to a 3rd peice of data and display all the entries in a decending ordered list ordered by the output of the calculation.. i think calculations can be added to querys...but as i said im new and the tutorial i read only coved reading values out of the db..

and just if it helps to clarify what im trying to do even though this is not part of the question... here is what im trying to do * set up a database and entry system that records the player name, base name, location,econ, and comment and stored this as a entry in the database..(i have done this) *on entry i wish to extract numeric values(AB,DF,CE) from a text string(location) (dont know how) *then i wish to display the list(i have done this) *a new column should be added on display containing the resuly of a calculation involving the numberic values from each entry with a global value that is entered on page(dont know how) *then the list should be sorted in decending order of the output of the calculation. *lastly i wish to be able to remove items from the list with a click.

thats all :) ,, seeking part advice and guidence

here is the page its php but i renamed it as text so its readble. cant past is as code as it has escape chars in it http://www.teamdelta.byethost12.com/trade/postroute3.txt

currently trying to use

$values = array(); $string = $location; $values[0]= $string[1].$string[2]; $values[1]= $string[5].$string[8]; $values[2]= $string[4].$string[7];

$x = intval($values[1], 10); $y = intval($values[2], 10); $g = intval($values[0], 10);

print_r($x); echo(' : '); print_r($y); echo(' : '); print_r($g);

+1  A: 

ok.. for the first part.

$values = array();

$values = split(":", 'DAB:CD:EF:GH');

$int_values = array();
foreach($values as $v) {
$int_values[] = intval($v, 10);
}

// values in base 10

print_r($int_values);
Gabriel Sosa
hummm,, wont this cause as issue as i will be trying to read D as a integer?, and wont i end up with DAB CD EF GH ?
Arthur
ok for this string..D03:57:16:23 it printed this Array ( [0] => 0 [1] => 57 [2] => 16 [3] => 23 ) .....seems to have dropped the 3
Arthur
Thinking about is although this solution is ok so far.. i know the input string will always be this fortat and so if i could just puck out chars 2,3,5,6,8,9,11,12 that wold be all i need for part one.
Arthur
ok i got round it by using what you tought me with a double split $values = array(); $tvalues = array(); $tvalues = split("D", $location); $values = split(":", $tvalues[1]); $int_values = array(); foreach($values as $v) { $int_values[] = intval($v, 10); } $x = $int_values[1];i guess i can then use maths operations on these to weed out the values i wish. cheers
Arthur