php - How can I make my query output the row value instead of the field value -


below code. ouputs field names instead of row values.

please how can make output rows have on database?

<?php  $conn_error = "could not connect"; $correct = "all correct!"; $host = "localhost"; $username = "ifacool"; $password = "1234";  $mysql_db = "ifacool";  if (!mysql_connect($host, $username, $password) || !mysql_select_db                      ($mysql_db)) { die ($conn_error); } else{        echo $correct . '<br>';  } $query = "select 'firstname', 'password' ifacooltable id = 1 "; if ($query_run = mysql_query($query)) {     while ($query_row = mysql_fetch_assoc ($query_run)){         $firstname = $query_row['firstname'];         $password = $query_row['password'];         echo $firstname . ' password ' . $password . ' exactly.<br>';     } } else {     echo "query failed"; } ?> 

use backticks ` instead of single quotes ' escape identifiers in mysql – select plain strings:

$query = "select `firstname`, `password` `ifacooltable` `id` = 1 "; 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -