Help with PHP function, super simple question, 1 min work.
$10-30 CAD
Pagado a la entrega
I need help with a PHP function im writing. My code:
function get_config() {
$db = dbServer::getInstance();
$mysqli = $db->getConnection();
$sql_query = 'SELECT * FROM server_config';
$result = $mysqli->query($sql_query);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$serverStatus = $row['server_status'];
$serverTitle = $row['server_title'];
}
}
}
Now, If I'd want to call the function and only echo let's say, $serverTitle, how should I do that? I.e:
get_config($serverStatus)?
Best regards
Nº del proyecto: #11398127
Sobre el proyecto
23 freelancers están ofertando un promedio de $20 por este trabajo
Hello! With 98% to 99% completion rate, 900+ successfully completed projects, and a 4.99 reputation (maximum possible, 5.0) (can be verified on my profile page https://www.freelancer.com/u/rajeshsonisl.html !!)... y Más
Once you accept bid & create milestone, i'll answer :) ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
PHP,PDO, Core-php, CakePHP, CodeIgniter, Laravel, Yii, Mysql, HTML, HTML5, CSS, JavaScript, Angular js, jquery, AJax, Joomla, E-Commerce Wordpress, Woo-commerce, Open- cart And BUG FIXING etc. When we work Más
hi, try this code adding the name of the column to print as an argument of the function the using it in the echo. function get_config($key) { $db = dbServer::getInstance(); $mysqli = $db->getConnection(); Más
hello, i am guessing that the the query returns only 1 row in that case it's vary easy. if it's more than 1 row then you would have to treat the result as an array else you are overwriting the values in each iteration.
Return the value if it is only one OR create an array and return that array from the function.I think it should be only one value.
Hello. I read your requirement. I can do it quickly. If you want to know me, please my profile. Please hire me. I will do my best. Thank you.
Dear Sir or Madam, Please find enclosed my proposal for your kind consideration. I am aware that creating client-oriented software takes a mixture of technical excellence and clear communication. I know that eve Más
I am working on my portfolio. I can provide solutions to your problem. Even better, ask me anything and I'll help as best I can