2

This is my table "OPTIONS"

enter image description here

Here i need to get site_logo,facebook and twitter values only from single mysql query.

Thank you

2
  • select * from options Commented Apr 18, 2014 at 7:36
  • 2
    you should have better taken efforts learn very basics of SQL before posting any question, this question only shows lack of efforts to just know what you want to achieve Commented Apr 18, 2014 at 7:40

3 Answers 3

1

As simple as it is..

SELECT id,option_key,option_value FROM options

or

SELECT * FROM options

You can do like this Using PDO

    $dbh = new PDO("mysql:dbname=pages;host=localhost", "username", "password");
    $sth = $dbh->prepare('SELECT id,option_key,option_value FROM options');
    $sth->execute();
Sign up to request clarification or add additional context in comments.

Comments

0

try this

SELECT * FROM TABLENAME ;

Comments

0

SELECT * FROM options` then, in the PHP:

while ($row=MySQLi_fetch_assoc($result))
{
    echo "<option value=\"".htmlspecialchars($row['option_value'])."\">".
    htmlspecialchars($row['option_key'])."</option>";
}

1 Comment

and don't forget to use htmlspecialchars for this approach

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.