SQL database : divide value stored in field

how to divide the value store in sql table in two diffrent variables

Page 1 of 1

1 Replies - 1624 Views - Last Post: 21 July 2009 - 03:30 PM

#1 desi22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-July 09

SQL database : divide value stored in field

Posted 21 July 2009 - 10:35 AM

Hi... everyone

i want to divide the value stored in mysql table & show them diffrently

structure :
database name : up
table: images
field name: details
details field stores in the format: 53 kb (800 x 600)

$q = "SELECT * FROM `images` WHERE id = '$id'";
  if(!($result_set = mysql_query($q))) die(mysql_error());
  $row = mysql_fetch_array($result_set);


i use this to Output details:
 echo "<tr><td width=\"25%\"><LABEL id='title'>Details:</LABEL></td><td> {$row['details']}</td></tr>";


which shows output : Details: 53 kb (800 x 600)

i want to separate size & resolution in output
e.g.
Details : 53 kb
Resolution : (800 x 600)

Is This A Good Question/Topic? 0
  • +

Replies To: SQL database : divide value stored in field

#2 June7  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 104
  • View blog
  • Posts: 904
  • Joined: 09-December 08

Re: SQL database : divide value stored in field

Posted 21 July 2009 - 03:30 PM

Use SQL functions LOCATE, MID, SUBSTRING, LENGTH
Here are links for help
http://www.w3schools...l_functions.asp
http://www.ibm.com/d...303stolze1.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1