I need advice re mysqli dropdown

Discussion in 'Databases' started by imaloon, Sep 21, 2016.

  1. imaloon

    imaloon

    Joined:
    Sep 21, 2016
    Messages:
    1
    Likes Received:
    0
    Hi, I've been trying to code up a file to create a mysqli dropdown displaying records from a database, link to a record ("target", a URL (www.xxxxxxx), by clicking on it.
    I'm also playing with condional coloring. Any suggestions(be nice lol) will be appreciated. Thanks in advance. This is my pastime.

    <!DOCTYPE HTML><html>
    <head>
    <script language="Javascript" type="text/javascript">
    function gotolink()
    {
    var destination= self.location;

    for(var i = 0; i<document.form.radiobutton.length; i++)
    {
    if(document.radioform.radiobutton.checked)
    { destination=document.radioformform.radiobutton.value }
    }
    window.location = destination;
    }
    </script>

    </head>
    <body><center><b>Email List<br>
    <form id="radioform" name="radioform" action="" method="post"
    accept-charset="UTF-8">

    <?php
    include('mysqli-connect.php');
    $query = "UPDATE emailtbl SET date-time='DATE()', visitcount='visitcount + 1'";
    $result = mysql_query($query) OR die(mysql_error());
    echo "Data successfully updated";

    $query = "SELECT target, username, password, purpose, emailused, date-time, visitcount, saved FROM emailtbl ORDER BY target ASC";

    <table border="1" cellspacing="2" cellpadding="2"> // Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\xxx on line xx
    <tr>
    <td>target</td><td>username</td><td>password</td><td>purpose</td>
    <td>emailused</td><td>date-time</td><td>visitcount</td><td>saved</td>
    </tr>
    while($res=mysql_fetch_assoc($result))
    {
    $counter=$counter + "1";
    if($counter=="1")
    { echo "<tr bgcolor='#FFD4FF'>"; }
    if($counter=="2")
    { echo "<tr bgcolor='#ccffff'>"; $counter=$counter - "2"; }
    echo <td>";
    echo "<input type=\"radio\" name=\"select\"onclick=\"window.open('$res['target']');\">
    echo "</td>";

    echo "<td>";echo $res['target'];echo "</td>";
    echo "<td>";echo $res['username'];echo "</td>";
    echo "<td>";echo $res['password'];echo "</td>";
    echo "<td>";echo $res['emailused'];echo "</td>";
    echo "<td>";echo $res['purpose'];echo "</td>";
    echo "<td>";echo $res['date-time'];echo "</td>";
    echo "<td>";echo $res['visitcount'];echo "</td>";
    echo "<td>";echo $res['saved'];echo "</td>";
    echo "</tr>";
    echo "</table>";
    }
    mysql_close();
    }
    ?>
    </form></body></html>
     
    imaloon, Sep 21, 2016
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.