Click here to Skip to main content
15,611,691 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Let's say I have an "append" table and a "weight" column in the database.

I want the "weight" value put into a PHP variable.

How can I handle that?

What I have tried:

<pre lang="PHP">
    $sql = "SELECT weight FROM append";

    if ($conn->query($sql) === TRUE) {
        echo "Successful";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;

    echo $sql;
Updated 26-Jan-23 3:03am
Andre Oosthuizen 26-Jan-23 11:18am    
Have a look at these 2 sites on how to use PHP's Data Objects - AND

1 solution

I suggest you start with a tutorial such as this one PHP MySQL: Querying Data from Database[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900