/ Published in: PHP
Simple but useful function for getting a single piece of data from a database and placing it straight into a variable.
Example:
$variable = one_result("SELECT columnOne FROM table WHERE columnTwo=whatever");
This would insert the value of columnOne where columnTwo is 'whatever' into $variable
Example:
$variable = one_result("SELECT columnOne FROM table WHERE columnTwo=whatever");
This would insert the value of columnOne where columnTwo is 'whatever' into $variable
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function one_result($query) { return($row[0]); }