Page 1 of 1

how to set a variable to a value in a MySQL DB?

Posted: Sun Dec 10, 2006 3:28 am
by Mythic Fr0st
THIS is not like the others lol...


Q1: how do I select a specific one line (E.G select line 32, and set a variable to it)

so $strlvlmon = $row['myrow'] (select certain line in that row)

Posted: Sun Dec 10, 2006 4:46 am
by dibyendrah
Do you want to fetch the long text and want to display only the certain line from that long text ?

umm

Posted: Sun Dec 10, 2006 5:14 am
by Mythic Fr0st
say I have

baby elf, (baby elf info)
wood elf, (wood elf info)
dark elf, (dark elf info)
blood elf, (blood elf info)

now, if I type the below it will reveal the stuff for baby elf, conditional to the row I want

Code: Select all

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("monsters", $con);

$result = mysql_query("SELECT * FROM m_l");

$row = mysql_fetch_array($result);
$ml=$row['mlvl'];       //<(mlvl being row)
$strlvlmon=$row['strlvlmon'];
$strdmgmon=$strlvlmon / 4;
$strdmg=rand(0, $strdmg * 1.3);
$strdmg=round($strdmg);
Now, how could I directly skip to say blood elfs stats? without typing the above 3 more times...

(btw mlvl is my main level, and i've set it to auto_increment thing, I read somewhere its used to track a certain section...
hmph

Posted: Sun Dec 10, 2006 8:34 am
by feyd
Stop making new threads for the same problem Mythic Fr0st. That's twice I've had to lock a thread. I won't let it go too much farther.