mysql query result in php variable -


is there way store mysql result in php variable? thanks

$query = "select username,userid user username = 'admin' "; $result=$conn->query($query); 

then want print selected userid query.

of course there is. check out mysql_query, , mysql_fetch_row if use mysql.
example php manual:

<?php $result = mysql_query("select id,email people id = '42'"); if (!$result) {     echo 'could not run query: ' . mysql_error();     exit; } $row = mysql_fetch_row($result);  echo $row[0]; // 42 echo $row[1]; // email value ?> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -