Help with PHP function, super simple question, 1 min work.

Cancelado Publicado hace 7 años Pagado a la entrega
Cancelado 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

PHP

Nº del proyecto: #11398127

Sobre el proyecto

23 propuestas Proyecto remoto Activo hace 7 años

23 freelancers están ofertando un promedio de $20 por este trabajo

rajeshsonisl

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

$14 CAD en 0 días
(702 comentarios)
8.1
syslogic

you're a) lacking a parameter which server's status is asked for and b) some kind of return statement. in general, your code is not written as it's meant to be... could provide that functionality for PHP PDO, properly Más

$30 CAD en 1 día
(30 comentarios)
5.9
PhpWebD

- I am a professional back-end developer. - 3 years experience in : * PHP (expert) * HTML (expert) * CSS (good) * jQuery (good) * Javascript (good) * Codeiginiter (very good) * Laravel (good) * Bootstrap ( Más

$10 CAD en 1 día
(34 comentarios)
4.7
bpestilence

Once you accept bid & create milestone, i'll answer :) ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

$25 CAD en 1 día
(5 comentarios)
3.6
hyadesfreelancer

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

$20 CAD en 0 días
(2 comentarios)
1.9
Ozumo

If you want a professional web developer so you are in the right place. I'm Web developer with great skills in web programming languages like: - Html - CSS - PHP - jQuery - ajax - javascript and frameworks li Más

$15 CAD en 1 día
(5 comentarios)
1.5
abdelelamel

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

$25 CAD en 1 día
(1 comentario)
0.6
Biniamxh

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.

$20 CAD en 1 día
(1 comentario)
0.4
sandeep987612

i will like to do the work.

$15 CAD en 10 días
(0 comentarios)
0.0
Lultu

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.

$25 CAD en 1 día
(0 comentarios)
0.0
khimmonzon122107

A proposal has not yet been provided

$25 CAD en 1 día
(0 comentarios)
0.0
sunsworld

Hello Sir, Thanks for sharing your requirement with us, we are an Indian development company and have checked your project details. We want to more clarifications in your posted details to provide you exact estim Más

$23 CAD en 7 días
(1 comentario)
0.0
daviddream0125

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.

$25 CAD en 0 días
(0 comentarios)
0.0
kusnadi02id

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

$15 CAD en 1 día
(0 comentarios)
0.0
rendytan1

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

$10 CAD en 1 día
(0 comentarios)
0.0
vinodahir2011

A proposal has not yet been provided

$10 CAD en 1 día
(0 comentarios)
0.0