Jump to content

imsry

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by imsry

  1. imsry

    MySQL Task

    bump
  2. by the order in which they were entered? like i dont want to order by a specific row in my table, i want to list the data by which it was entered. maybe i can add a row that enters column #s somehow??
  3. The code works but the title is repeated with each new set of data. I want the titles set up at the top and never repeating... No idea what is causing it. $conn = new mysqli($servername, $username, $password, $dbname); $sql = "SELECT deadchar, level, class, killforumid, realm, date FROM pkdata ORDER BY deadchar DESC"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { $deadchar = $row['deadchar']; $level = $row['level']; $class = $row['class']; $killforumid = $row['killforumid']; $realm = $row['realm']; $date = $row['date']; $conn->close(); echo "<table><center><tr> <th> <font size=3 color=#070719>Victim</font> </th> <th> <font size=3 color=#070719>Level</font> </th> <th> <font size=3 color=#070719>Class</font> </th> <th> <font size=3 color=#070719>Killer</font> </th> <th> <font size=3 color=#070719>Realm</font> </th> <th> <font size=3 color=#070719>Date</font> </th> </tr></center>"; echo "<tr><center> <td><center>$deadchar</center></td> <td><center>$level</center></td> <td><center>$class</center></td> <td><center>$killforumid</center></td> <td><center>$realm</center></td> <td><center>$date</center></td> </tr>"; echo "</table>"; } ?>
  4. imsry

    MySQL Task

    lil sloppy and two sep connections, ill merge em together if it works, but here is what i worked out <?php $deadchar = $_GET['deadchar']; $level = $_GET['level']; $class = $_GET['class']; $killacct = $_GET['killacct']; $realm = $_GET['realm']; $date = $_GET['date']; $servername = "diipk.net.mysql"; $username = "diipk_net"; $password = "fkdivin123"; $dbname = "diipk_net"; $sql=mysqli_connect($servername,$username,$password,$dbname); $killforumid = mysqli_query($sql,"SELECT `killforumid` FROM `pkusers` WHERE killacct = '$killacct'"); try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO pkdata (deadchar, level, class, killacct, realm, date) VALUES ('$deadchar','$level', '$class', '$killforumid',$killacct '$realm', '$date')"; // use exec() because no results are returned $conn->exec($sql); echo "w00tw00t"; } catch(PDOException $e) { echo $sql . "<br>" . $e->getMessage(); } $conn = null; ?>
  5. imsry

    MySQL Task

    well i can change my part of the code, but ill post it anyways. assume i defined the connection variables ofc. OKAY. so each of these first variables will be defined from an outside source, but for killacct, i want to use that variable to get a new one. i will have a separate sql table 'whatever' killacct = A forumid = B so i want this code to take killacct and query my seperate sql table to get forumid. then for values i can add 'forumid' <?php $deadchar = $_GET['deadchar']; $level = $_GET['level']; $class = $_GET['class']; $killacct = $_GET['killacct']; $realm = $_GET['realm']; $date = $_GET['date']; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO pkdata (deadchar) VALUES ('$deadchar', '$level', '$class', '$realm', '$date')"; // use exec() because no results are returned $conn->exec($sql); echo "New record created successfully"; } catch(PDOException $e) { echo $sql . "<br>" . $e->getMessage(); } $conn = null; ?>
  6. wanting to take a variable and use that variable to search my sql table for another variable example : (from outside prog XXX is sent in as 'killacct') $killacct = $_GET['killacct']; now take 'killacct' and search table 'blahblah' for the row 'variable' so if the table was killacct = XXX | blahblah = YYY so then i can pull a second variable from my first one XXX is associated with YYY sorry this was probably really hard to understand im very exhaused lol
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.