Jump to content

PNewCode

Members
  • Posts

    320
  • Joined

  • Last visited

Posts posted by PNewCode

  1. Hello. This is what I have working so far, and this works without a problem (see after for why I'm posting this)
    Right now, this file will add information to 2 different databases (one of them serves as a backup, the other can be edited as needed)
    This also removes one "token" from the user in the session.
    Perfect! Thats what I need it to do.


    HOWEVER, what I also need it to do, is add a token to the user defined by "gname" in this same transaction.

    In the page that is sending the info to the below scripting, the person logged in (fname) selects a user to give a token to (gname)

    Any thoughts from all of you amazingly smart people here, on what to add to this to make it work would be appreciated. I seem to hit a brick wall.

    In case anyone wants to know "why" I'm doing this... here is the break down
    A user is logged in. They decided they would like to give a different user one of their tokens (because they are just a nice person). So they send one to them. At the same time, this transaction is being sent to 2 more databases. One of the databases will be cleared out each day. The other one will store all the transactions as a way to look up the history of transactions. (it's the long way around, but I'm old and this is the easiest way for me to do this)


    What I tried:
    Besides the endless alterations from stuff I googled that didn't work, I also tried to duplicate the linke for -1 and change it to +1 but it didn't do anything (even when I changed it to gname)

     

    <?php
    
    
    
    
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    
    
    
    
    
    // Start the session
    session_start();
    
    $servername = "Deleted To Post This";
    $database = "Deleted To Post This";
    $username = "Deleted To Post This";
    $password = "Deleted To Post This";
    
    $servernameS = "Deleted To Post This";
    $databaseS = "Deleted To Post This";
    $usernameS = "Deleted To Post This";
    $passwordS = "Deleted To Post This";
    
    
    
    // Create connection
    $conn = mysqli_connect($servername, $username, $password, $database);
    $connS = mysqli_connect($servernameS, $usernameS, $passwordS, $databaseS);
    
    
      
    // Check connection
    if (!$conn) {
          die("Connection failed: " . mysqli_connect_error());
    }
    
    if (!$connS) {
          die("Connection failed: " . mysqli_connect_error());
    }
     
    echo " ";
    
    
        $fname1 = $_POST['fname'];
        $tokens1 = $_POST['tokens'];
        $gname1 = $_POST['gname'];
     
    
        $fname = mysqli_real_escape_string($conn , $fname1);
        $tokens = mysqli_real_escape_string($conn , $tokens1);
        $gname = mysqli_real_escape_string($conn , $gname1);
    
    
          $hostname_l = "Deleted To Post This";
      $username_l = "Deleted To Post This";
      $password_l = "Deleted To Post This";
      $dbname_l = "Deleted To Post This";
      
       $conn_l = mysqli_connect($hostname_l, $username_l, $password_l, $dbname_l);
      if(!$conn_l){
        echo "Database connection error".mysqli_connect_error();
      }
      $user_id = $_SESSION['id']; 
      $sql_l = "SELECT * FROM users WHERE id = '$user_id'";
      
      
    
    
    $result = $conn_l->query($sql_l);
    
    if ($result->num_rows > 0) {
      // output data of each row
      while($row = $result->fetch_assoc()) {
     $user_token =  $row["token"];
     
     $fname =  $row["fname"];
      
      }
    } else {
      echo "0 results";
    }
     if($user_token >= 1){
         
     }else{
         
         echo "<h2 style='text-align:center;color:white'>You don't have enough tokens </h2><br><center><a href='moretokens.php'><img src='buytokens.png' border='0'></a><center>
    
    <br><br><br><br><br><br><br><br><br><br>
    
    <center><a href='main.php'><img src='imgs/cancel.png' border='0'></a><center>
    
    ";
         die();
     }
    
    
    $sql = "INSERT INTO nametable (fname, tokens, gname) VALUES ('$fname', '$tokens', '$gname')";
    if (mysqli_query($conn, $sql)) {
        
        
          
     
     
    $user_updated_token = ($user_token) - 1;
    
      $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$user_id";
    
    
    
    if ($conn_l->query($sql_l) === TRUE) {
      echo "";
    } else {
      echo "Error updating record: " . $conn_l->error;
    }
    
    
    
    
    
    } else {
          echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }
    
    if (mysqli_query($connS, $sql)) {
          echo " ";
    } else {
          echo "Error: " . $sql . "<br>" . mysqli_error($connS);
    }
    
    
    
    
    $id = mysqli_insert_id($conn);
    
    
    
    
    
    
    
    
    mysqli_close($conn);
    mysqli_close($connS);
    ?>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <body link="#CCCCFF" vlink="#CCCCFF" alink="#CCCCFF">
    
    
    <script>
    document.addEventListener('contextmenu', event => event.preventDefault());
    </script>
    
    
    <style type="text/css">
    body {background:none transparent;
    }
    </style>
    
    
    
    
    
    <div align="center">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td valign="top" height="84" colspan="7"> 
            <div align="right"> 
              <p><br>
              </p>
            </div>
            <div align="center">
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p><img src="../requests/imgs/completed.png" width="500" height="300"></p>
              <p><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Now 
                Sending You Back To Token Gift Options<br>
                </font><font face="Verdana, Arial, Helvetica, sans-serif"><br>
                <br>
                </font></p>
            </div>
          </td>
        </tr>
      </table>
    </div>

     

  2. @requinixyes in a way. However I found a trick in the depth of the internet that makes it exactly how I want it (this might be what you were talking about I'm not sure). I added
     

        66% { opacity:0; }

    Between the 0% and 100% and it allows a delay. I had to lengthen the time of total animation to make it work but it's perfect.

  3. @requinixI decided to just add a meta tag to have it redirect after 4 seconds to the next page so no click needs to be done, however I would like to have the animation delayed 2 or 3 seconds before it fades in the second picture. Do you know how I can alter what I have to do that? I tried adding some coding in it from what I have seen online in examples but none of them seem to work, but then again the examples I saw didn't have what I have set up either so I'm lost on how to do that.

  4. I have the following script below. The fade in is working beautifully. What I want to do is make it so that 2nd image doesn't fade in untill the first image is clicked on (the first image is acting as a button)
    And then after the 3 seconds for the fade in, it goes to a different URL. Any thoughts?

     

    
    <!DOCTYPE html>
    <html>
    <head>
    
    
    
    
    
    <body bgcolor="#000000" marginwidth="0" marginheight="0">
    <div class="parent"> <img class="image1" src="../trial-images/unzoomdoor.jpg" width="100%" height="887" border="0" /> 
      <img class="image2" src="../trial-images/zoomdoor.jpg" width="100%" height="887" border="0" /> 
    </div>
    
    
    
    
    
    <style>
    .parent {
      position: relative;
      top: 0;
      left: 0;
    }
    
    .image1 {
      position: relative;
      top: 0;
      left: 0;
      border: 0px solid #000000;
    }
    
    .image2 {
      position: absolute;
      top: 0px;
      left: 0px;
      border: 1px solid #000000;
      animation: fadeIn 3s;
      -webkit-animation: fadeIn 3s;
      -moz-animation: fadeIn 3s;
      -o-animation: fadeIn 3s;
      -ms-animation: fadeIn 3s;
    }
    
    @keyframes fadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
    }
    
    @-moz-keyframes fadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
    }
    
    @-webkit-keyframes fadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
    }
    
    @-o-keyframes fadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
    }
    
    @-ms-keyframes fadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
    }
    }
    </style>
    
    
    </body>
    </html>
    

     

  5. @gizmolaThank you very much for taking all that time to give some assistance. I really appreciate that. Looks like at this point I can either go without the page working untill I can learn enough to understand everything you just said, or dig up some pennies to hire someone to make me a new one (which will probably have to be my solution so I have something untill I learn more)

    I will definitely use your reply to do research and get better educated. Thank you :)

  6. Hello. I have six files (I'll show the scripts below except for the delete.php because that doesn't matter in this). This was a project that I paid someone to do a year ago, so I can't tell you why "this or that" was put in any of the coding because I didn't create it. While I've learned a lot since then, I can't figure out why all of the sudden last week it stopped working. 
    How it used to work...

    1: A website user would fill out a form and click send
    2: The information would go to the database and in the alert database
    3: The view page to see the messages would give an alert sound and make the page flash a color when a new entry was added to the database

    Please don't ask why I want this. Thats not important. Also please don't ask why I'm doing this way instead of "that" way. Because I paid someone to make this, and this is what I got. I worked for a long time and suddenly stopped. I didn't make any changes.

    Any help on why this no longer works is greatly appreciated ❤️

    What does work:
    The entry gets added to the database from the form, and is visible as needed. And delete function works as well.

    What doesn't work:
    The alert sound and making the page flash red.

     

    Form (msgform.php)

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    </head>
    <style type="text/css">
    body {background:none transparent;
    }
    </style>
    
    
    
    <body bgcolor="#FFFFFF" marginwidth="0" marginheight="0" text="#000000" leftmargin="0" topmargin="0" link="#FF0000" vlink="#FF0000" alink="#FF0000">
    <form action="insertmsg.php" method="post" autocomplete="off">
      <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"> 
        <b><font color="#FFFF00">Name</font></b> 
        <input type="text" name="name" size="17" required />
        <b><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"> 
        <font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><font color="#FFFF00"><font face="Verdana, Arial, Helvetica, sans-serif" size="4"> 
        <input type="hidden" name="reply" size="20" required value="https://www.peredy1.com/mods/msg/noall.php"/>
        </font></font></font></font></font></font> </font></font></font></font></font></font></font></font></font></b> 
        <b><font color="#FFFF00"><br>
        Link</font></b> <font color="#FFFF00"> 
        <input type="text" name="band" size="20" />
        <br>
        <font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b>Message</b></font></font><font size="3"><i><br>
        </i></font> 
        <textarea name="extra" cols="34" rows="4" required></textarea>
        </font><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><br>
        <input type="image" class="alertclick" src="redsend.jpg" name="image" />
        <img src="cancel.jpg" border="0" onClick="window.history.go(-1)"></font> 
      </p>
    </form>
    <div id="test"></div>
    
    
    <div id="test"></div>
    
    <script type="text/javascript">
    
      $(".alertclick").click(function(){
    
          $('#test').load('alert.php');
    
    
      })
    </script>



    Insert to DB (insertmsg.php)
     

    <?php
    $servername = "localhost";
    $database = "removed for public view";
    $username = "removed for public view";
    $password = "removed for public view";
    
    
    // Create connection
    $conn = mysqli_connect($servername, $username, $password, $database);
    // Check connection
    if (!$conn) {
          die("Connection failed: " . mysqli_connect_error());
    }
    
     
     
    echo ".";
    
    
        $name1 = $_POST['name'];
        $band1 = $_POST['band'];
        $song1 = $_POST['song'];
        $extra1 = $_POST['extra'];
        $reply1 = $_POST['reply'];
    
     $name = mysqli_real_escape_string($conn , $name1);
        $band = mysqli_real_escape_string($conn , $band1);
        $song = mysqli_real_escape_string($conn , $song1);
        $extra = mysqli_real_escape_string($conn , $extra1);
        $reply = mysqli_real_escape_string($conn , $reply1);
    
     
    $sql = "INSERT INTO nametable (name, band, song, extra, reply) VALUES ('$name', '$band', '$song', 'Message: $extra', '$reply')";
    if (mysqli_query($conn, $sql)) {
          echo " ";
    } else {
          echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }
    
    
    
    mysqli_close($conn);
    ?>
    <style type="text/css">
    body {background:none transparent;
    }
    </style>
    
    <meta http-equiv = "refresh" content = "2; url = msgform.php" />
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <body bgcolor="#FF6600" text="#000000" link="#FF0000" vlink="#FF0000" alink="#FF0000">
    <div align="center">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td valign="top" height="84" colspan="7"> 
            <div align="right"> 
              <p><br>
              </p>
            </div>
            <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFF00"><b>Completed</b></font><font color="#FFFFFF"><b></b></font><font face="Verdana, Arial, Helvetica, sans-serif"><br>
              <br>
              </font></div>
          </td>
        </tr>
      </table></div>

    Alert Generator (alert_generate.php)

    <?php
    $servername = "localhost";
    	$username = "removed for public view";
    	$password = "removed for public view";
    	$db="removed for public view";
    	$conn = mysqli_connect($servername, $username, $password,$db);
    
    	// $sql = "INSERT INTO `number`( `number`) 
    	// VALUES ('$qty')";
    $sql = "SELECT alert_status FROM alert";
    
    $result = $conn->query($sql);
    $alertvar = 0;
    if ($result->num_rows) {
        // output data of each row
        while($row = $result->fetch_assoc()) {
              if($row["alert_status"] == 1){
    echo '<div class="redalert3"></div>';
    
    	$alertvar = 1;
    
    
    }else{
    
    }
        }
    }
    if($alertvar == 1){
    echo '<script>var x = document.getElementById("myAudio3");  x.play(); </script>';
    $qty=3;
    	// $sql = "INSERT INTO `number`( `number`) 
    	// VALUES ('$qty')";
    $sql = "UPDATE alert SET alert_status=$qty WHERE id=1";
    
    
    	if (mysqli_query($conn, $sql)) {
    		echo json_encode(array("statusCode"=>200));
    	} 
    	else {
    		echo json_encode(array("statusCode"=>201));
    }
    	mysqli_close($conn);
    }
    $conn->close();
    ?>

    The Alert (alert.php)

    <?php
    	$servername = "localhost";
    	$username = "removed for public view";
    	$password = "removed for public view";
    	$db="removed for public view";
    	$conn = mysqli_connect($servername, $username, $password,$db);
    
    
    $qty=1;
    	// $sql = "INSERT INTO `number`( `number`) 
    	// VALUES ('$qty')";
    $sql = "UPDATE alert
    SET alert_status=$qty
    WHERE id=1";
    
    
    	if (mysqli_query($conn, $sql)) {
    		echo json_encode(array("statusCode"=>200));
    	} 
    	else {
    		echo json_encode(array("statusCode"=>201));
    	}
    	mysqli_close($conn);
    
    
    ?>

    View messages (view.php)

    <html>
    <head>
    
    
    
    <style>
    .redalert3:after {
        background-color: red;
        content: "";
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
    left:0;
    }
    </style>
    
    
    
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    
    
    <title>Peredy Host Tool</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="Author" content="Peredy Izhere" />
    <meta name="copyright" content="&copy; 2009-2021, All Rights Reserved" />
    <meta name="revisit-after" content="7 days" />
    <meta http-equiv="refresh" content="7" >
    
    <link rel="apple-touch-icon" sizes="57x57" href="/fi/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/fi/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/fi/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/fi/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/fi/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/fi/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/fi/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/fi/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/fi/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192"  href="/fi/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/fi/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="/fi/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/fi/favicon-16x16.png">
    <link rel="manifest" href="/fi/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/fi/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">
    
    
    
    </head>
    
    <body text="#FFFFFF" link="#FF6600" vlink="#FF6600" alink="#FF6600">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="3"> 
    
    
    <div class="alertadd"></div>
    <audio id="myAudio3"> <source src="alertsound3.mp3" type="audio/mpeg"> 
    </audio> </font> 
    
    
    
    <script>
    document.addEventListener('contextmenu', event => event.preventDefault());
    </script>
    
    
    <style type="text/css">
    body {background:none transparent; }
    </style>
    
    
    
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr valign="top"> 
        <td height="180"> 
          <p> <font face="Verdana, Arial, Helvetica, sans-serif"> 
    
    
    <?php
    $servername = "localhost";
    $username = "removed for public view";
    $password = "removed for public view";
    $dbname = "removed for public view";
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
    }
    
    $sql = "SELECT id, name, band, song, extra, reply FROM nametable";
    $result = $conn->query($sql);
    
    
    $resultt = mysqli_query($conn, "select COUNT(id) AS count FROM `nametable`");
    
    if(!$result) {
        die('Error: ' . mysqli_error($link));
    } else {
        $num_rows = mysqli_fetch_assoc($resultt);
        // echo it
        echo "<font color='yellow'>Total Messages</font>: <font color='red'><b>" . $num_rows['count']."</font></b></br>";
    }
    
    if ($result->num_rows > 0) {
      // output data of each row
      while($row = $result->fetch_assoc()) { ;  ?><br>
            <font color='orange'>Message From: </font></font><font color="aqua" face="Verdana, Arial, Helvetica, sans-serif"><?php 
    echo htmlspecialchars($row["name"]);  ?><br>
            <font color='lightblue'>Link From Viewer: </font><a target="_blank"  href='<?php echo $row["band"] ; ?> ' ><?php echo htmlspecialchars($row["band"]);  ?></a></font> 
            <font color="aqua" face="Verdana, Arial, Helvetica, sans-serif">
            <br>
            <font color='white'> <?php echo nl2br(htmlspecialchars($row["extra"]). "<br><br><a href='delete.php?id=".$row['id']."'>Delete</a>&nbsp;|&nbsp;<a href='".$row['reply']."'>Reply</a><br>___________<br>",60);
      }
    } else {
      echo "0 Messages";
    }
    $conn->close();
    ?>
    
    
    
    </font></font></p>
    
    
    <pre>&nbsp;</pre>
    
    
          <audio id="myAudio3"> 
          <source src="alertsound3.mp3" type="audio/mp3"> 
          </audio> 
    
    
    
    <script type="text/javascript">
      setInterval(function(){
          $('.alertadd').load('alert_generate.php');
     },300);
    </script>
    
    
    
        </td>
      </tr>
    </table>
    
    </body>
    </html>

     

  7. Hello,

    I've searched around but I think I must not know how to phrase the question because I cannot find a solution. 

    OBJECTIVE: I have a page where an image that acts like a button sends the information to another php page. And that page that gets the information is inserted to a database.
    I need to have this one button send it to TWO php pages, as each of them perform the same function, but different databases.

    Summary of what I am wanting to do: Make this one button post to 2 different php files.

    Here is my code that works perfectly for just one php file:
     

    echo  " <form class='leftf' action='process2.php' method='post'><input type='hidden' name='actionType' value='order_change'><input type='hidden' name='update_id' value='$updateID'><input type='hidden' name='current_postion' value='$order_change'><input type='hidden' name='order_change' value='$order_change_up' required><button type='submit'><img src='up.jpg'></button></form>";

     

  8. @Barand sorry I didn't see it. My apologies. 

    Table Users has the id as unique_id

    Table Messages has the id as user_id

    Somehow one user has both of those. But I just needed to delete all from the table messages under user_id="user id here" and grab it from the unique_id from the other table.

    But I know it can't work anyways unless I change the name of the column in one of the tables, which would end up with over 60+ pages of editing so it's just going to be easier to make 2 different files that each have their own query and include each on one page. Thank you all for the time anyways

  9. @ginerjm As to WHY it works, that I can't tell you. I had a page already made that works for one query and I just added the extra stuff to try for a different table in the same DB.

    The ID's can't be the same in both tables because one is for a user id, the second is for a message id.

    So the first one deletes the user from the DB, and the second one just clears all their messages. I cannot change the column names because it would break the whole build and I would rather make 2 delete pages than to rewrite 60+ other pages that are using the same databases.

    So this is why I'm trying to get both to work in the same page

  10. @ginerjm I stated what is "The first link". It says it specifically in my second post on this. See this from that post...

    The first link does grab the id (from table "users")
    <a href='delete-user.php?id=".$row['unique_id']."'>Remove User</a>

    But the second one does not (from table "messages")
    <a href='delete-messages.php?id=".$row['user_id']."'>Clear User Chat</a>

    Now, the problem using the comas is that the first table users has multiple columns to choose from named unique_id, fname, lname
    and the second table messages only has one I am using, named user_id

    So if I just split them up in comas, then there is nothing to sort which results are from just the two tables.
    If I put it as you did with the u and m, then the links (see above) wont pull those id's from the tables.

    I'm not sure why you don't know why you don't know what I mean by first link when I said it directly above that line of code

    So the objective, is for the first link, it grabs the id from users
    and the second link, it grabs the id from messages

    NOTE: the first link works just fine by the way

  11. @ginerjmhere is the break down.
    The two tables are "users" and "messages"

    The first link does grab the id (from table "users")
    <a href='delete-user.php?id=".$row['unique_id']."'>Remove User</a>

    But the second one does not (from table "messages")
    <a href='delete-messages.php?id=".$row['user_id']."'>Clear User Chat</a>

    So I'm guessing, like you said is in the 
    $sql = "SELECT unique_id, fname, lname AND user_id FROM users, messages";

    But I'm not sure how to change that to work for that second link
    <a href='delete-messages.php?id=".$row['user_id']."'>Clear User Chat</a>

  12. Hello. A little guidance if you don't mind and with my great appreciation.

    The objective is to have to links, that use 2 different functions, selecting from 2 different tables. Each link goes to a different page.
    So far, this is able to grab the id for the first link but not the second. Any thoughts of what I need to do different?
    NOTE: To be specific, it's the line to delete messages that isn't grabbing the id

     

    <?php
    // database info here
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
    }
    
    $sql = "SELECT unique_id, fname, lname AND user_id FROM users, messages";
    $result = $conn->query($sql);
    
    
    $resultt = mysqli_query($conn, "select COUNT(unique_id) AS count FROM `users`");
    
    if(!$result) {
        die('Error: ' . mysqli_error($link));
    } else {
        $num_rows = mysqli_fetch_assoc($resultt);
        // echo it
        echo "<font color='yellow'>Total Users</font>: <font color='aqua'><b>" . $num_rows['count']."</font></b></br></br>";
    }
    
    if ($result->num_rows > 0) {
      // output data of each row
      while($row = $result->fetch_assoc()) { ;  ?> <font color='orange'>User Name: 
          </font><font color='black'><?php 
    echo htmlspecialchars($row["fname"]);  ?>&nbsp;<?php 
    echo htmlspecialchars($row["lname"]);  ?>
    
    
    <br>
    
    
          <font color='orange'>ID: 
          </font><font color='black'> 
    
    
    
    <?php echo nl2br(htmlspecialchars($row["unique_id"]). "
    <a href='delete-user.php?id=".$row['unique_id']."'>Remove User</a>&nbsp;
    
    
    
    
    <a href='delete-messages.php?id=".$row['user_id']."'>Clear User Chat</a>
    ___________<br><br>",60);
      }
    } else {
      echo "0 Users";
    }
    $conn->close();
    ?>

    Any help is very much appreciated

×
×
  • 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.