php - Fetch 1 column value from mysql database -
i have following column in database: http://i.stack.imgur.com/omyjc.png
how can make read column , write example.com
site?:
echo "your website: " . $website;
note i'm starter php.
as new php, first learn database connectivity through php check out : http://php.net/manual/en/mysqli.quickstart.connections.php
after successful database connection, try how query on database through php check out : http://php.net/manual/en/mysqli.quickstart.statements.php
sample code :
$mysqli = new mysqli("example.com", "user", "password", "database"); if ($mysqli->connect_errno) { echo "failed connect mysql: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $mysqli->real_query("select website my_table"); $res = $mysqli->use_result(); while ($row = $res->fetch_assoc()) { echo " website = " . $row['website'] . "\n"; }
Comments
Post a Comment