Restituisci solo una variabile da MySQL Query - Trucchi CSS

Anonim

Funzione

function mysql_get_var($query,$y=0)( $res = mysql_query($query); $row = mysql_fetch_array($res); mysql_free_result($res); $rec = $row($y); return $rec; )

Utilizzo

$name = mysql_get_var("SELECT name from people where email = '(email protected)'");

Restituirà il campo del nome, quindi ciò che verrà restituito sarà "Roger" (se quello era il mio nome nel database).