Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Live Search en PHP usando AJAX funcionando, pero los botones no están en td

mi búsqueda en vivo funciona perfectamente, pero mis etiquetas no están en td. No puedo entender cuál es el problema. La imagen y el código están a continuación. Gracias de antemano. El problema está ahí abajo en td, las etiquetas. como se ve

 enter code here <?php @include('./config/constants.php'); $output = ''; if (isset($_POST['query'])) { $search = $_POST['query']; $stmt = $conn->prepare("SELECT * FROM clients WHERE full_name LIKE CONCAT('%',?,'%') OR email LIKE CONCAT('%',?,'%')"); $stmt->bind_param("ss", $search, $search); } else { $stmt = $conn->prepare("SELECT * FROM clients"); } $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $output = "<tr> <th>ID</th> <th>Full Name</th> <th>E-mail</th> <th>Phone</th> <th>City</th> <th>Address</th> <th>Actions</th> </tr> "; while ($row = $result->fetch_assoc()) { $output .= "<tr> <td>" . $row['id'] . "</td> <td>" . $row['full_name'] . "</td> <td>" . $row['email'] . "</td> <td>" . $row['phone'] . "</td> <td>" . $row['city'] . "</td> <td>" . $row['address'] . "</td> <td>" ?> <a href="<?php echo SITEURL; ?>/update-client.php?id=<?php echo $row['id']; ?>" class="main-btn">Update Client</a> <a href="<?php echo SITEURL; ?>/delete-client.php?id=<?php echo $row['id']; ?>" class="danger-btn">Delete Client</a> <?php "</td> </tr>"; } echo $output; } else { echo "<h3>No Records found!</h3>"; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está generando los enlaces antes de las filas de la tabla.
Los genera directamente y luego genera las filas en la variable $output .
Elimine las etiquetas ?> y <?php en su bucle while y haga que los botones formen parte de la cadena $output

 while ($row = $result->fetch_assoc()) { $output .= "<tr> <td>" . $row['id'] . "</td> <td>" . $row['full_name'] . "</td> <td>" . $row['email'] . "</td> <td>" . $row['phone'] . "</td> <td>" . $row['city'] . "</td> <td>" . $row['address'] . "</td> <td>" . '<a href="'.SITEURL.'/update-client.php?id='.$row['id'].'" class="main-btn">Update Client</a>'. '<a href="'.SITEURL.'/delete-client.php?id='.$row['id'];.'" class="danger-btn">Delete Client</a>'. ."</td> </tr>"; }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!