PHP Passing ID in href

0 votes

I want to have editable rows in my table so I need to link the PHP file while passing the id from my database Fetches. The problem is that the 'a href' won't show me any id when I get to the edit.php page.

  <?php
$user = 'root';
$password = 'root';
$db = 'projekte_db';
$host = 'localhost';
$port = 3306;

$con = mysqli_connect($host, $user, $password, $db);
$query = "Select id,name,ort,strasse,projektleiter from Projekt";
$result = mysqli_query($con,$query);

while($row = mysqli_fetch_array($result)){
    echo "<tr>
    <td>".$row["id"]."</td>
    <td>".$row["name"]."</td>
    <td>".$row["ort"]."</td>
    <td>".$row["strasse"]."</td>
    <td>".$row["projektleiter"]."</td>

    <td><a href='edit.php?id='".$row["id"]."alt='edit'>Bearbeiten</a></td>
    </tr>";
}?>

Can someone help me with this?

May 27, 2022 in PHP by Kichu
• 19,050 points
3,577 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

What is meant by passing the variable by value and reference in PHP?

Hello, When the variable is passed as value ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
3,220 views
0 votes
1 answer

How do I get the last inserted ID of a MySQL table in PHP?

Hello @kartik, If you're using PDO, use PDO::lastInsertId. If you're ...READ MORE

answered Oct 22, 2020 in PHP by Niroj
• 82,880 points
2,152 views
0 votes
1 answer

How to find Object ID in PHP?

Hello @kartik, Use spl_object_hash() for that. It returns an unique identifier ...READ MORE

answered Nov 16, 2020 in PHP by Niroj
• 82,880 points
1,910 views
0 votes
0 answers

header location with id in php

Can a row ID be passed to ...READ MORE

Aug 6, 2022 in PHP by Kithuzzz
• 38,020 points
1,832 views
0 votes
1 answer

What is type casting and type juggling in php?

Hey, The way by which PHP can assign ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
7,144 views
0 votes
2 answers

How can we create a session in PHP?

Hello, niroj. Here is my idea session_start(); $_SESSION['USERNAME'] ...READ MORE

answered Dec 7, 2020 in PHP by Famous
• 140 points
1,136 views
0 votes
1 answer
0 votes
1 answer

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in.

The issue is that the query given to mysqli_query() is ...READ MORE

answered May 1, 2022 in Other DevOps Questions by narikkadan
• 63,720 points
1,622 views
0 votes
0 answers

Warning: mysqli_query() expects at least 2 parameters, 1 given. What?

I have to build a PHP page ...READ MORE

May 12, 2022 in PHP by Kichu
• 19,050 points
1,246 views
0 votes
0 answers

Object of class mysqli_result could not be converted to string

Code: $result = mysqli_query($con, "SELECT classtype FROM learn_users ...READ MORE

May 15, 2022 in PHP by Kichu
• 19,050 points
1,494 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP