0

This is my below mention PHP code What I want When I click a total employee a company1.php file will open against compnyID

My PHP code

    <?php
    require_once 'tabconnect.php';
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
    $query1 = mysqli_query($connection,"SELECT COUNT(cemployees.companyID),cemployees.companyID FROM cemployees WHERE companyID=$id");
    while ($row6 = mysqli_fetch_array($query1)) {
$totalman1 = $row6[0];<a><?php echo "" . $totalman1; "<a href=\"company1.php?id={$row6['companyID']}\"></a>"?> Employees                                                                                     
    <?php
     }          
      }?>              
  • **Warning:** Your code is vulnerable to SQL Injection attacks. You should use parameterised queries and prepared statements to help prevent attackers from compromising your database by using malicious input values. http://bobby-tables.com gives an explanation of the risks, as well as some examples of how to write your queries safely using PHP / mysqli. **Never** insert unsanitised data directly into your SQL. The way your code is written now, someone could easily steal, incorrectly change, or even delete your data. – ADyson May 07 '20 at 09:58
  • In all cases logo this is not working. At that cases logo comes from my sql table – gautam bose May 07 '20 at 10:01
  • Anyway...are you asking how to change the base URL of the link depending on whether your code is running on the local server or the live server? It sounds like it. This might help you: https://stackoverflow.com/questions/2820723/how-do-i-get-the-base-url-with-php – ADyson May 07 '20 at 10:02

0 Answers0