0

I retreive an variable in mysql database using this function

function getComplaints(){
        $issues ="";
        $con = mysql_connect($this->dbHost,$this->dbUsername,$this->dbPassword) 
                                                    or die("Database Connection Error!");
        mysql_select_db($this->dbName,$con);

        $result=mysql_query("SELECT * FROM issues") 
                                                    or die(mysql_error());

        $count=mysql_num_rows($result);
        while($row=mysql_fetch_array($result)){
            $id = $row['problem_id'];
            $issues = '<input type="submit" value=$id />';
        }

        return $issues;
    }

How to do embedd $id in $issues string?

2 Answers 2

1

change to:

...
while($row=mysql_fetch_array($result)){
    $id = $row['problem_id'];
    $issues.= '<input type="submit" value="'.$id.'" />';
}
return $issues;
...
Sign up to request clarification or add additional context in comments.

Comments

0

Use string concatenation

$issues = '<input type="submit" value="' . $id . '" />';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.