This topic is locked
[SOLVED]

 Database API

2/7/2020 1:18:27 PM
PHPRunner General questions
milver author

Hello Guys!
I have a question. How do i return the columns header in query executed?

Sergey Kornilov admin 2/7/2020

I'm not sure I understand your question, please rephrase.

milver author 2/10/2020



I'm not sure I understand your question, please rephrase.


For example:
I have a table:


I want get header only:


For return, i used javascript code:
[size="3"]Server:[/size]


[size="3"]ClientAfer[/size]


Sergey Kornilov admin 2/10/2020

Use array_keys function:

https://www.php.net/manual/en/function.array-keys.php



...

$data=$rs->fetchAssoc();

$names = array_keys($data);


Now $names array contains the list of columns from your query.

milver author 2/10/2020



I'm not sure I understand your question, please rephrase.


Now i want to return all records from query without pass columns informations
For example:
[font="Consolas"][color="#008080"][size="2"]while( $data = $rs->fetchAssoc() )[/size]
[font="Consolas"][color="#008080"][size="2"] $allrecords = array_merge([/size]

}

[/size]
[font="Consolas"][size="2"]but don't work! [/size]

milver author 2/11/2020



Now i want to return all records from query without pass columns informations
For example:
[font="Consolas"][color="#008080"][size="2"]while( $data = $rs->fetchAssoc() )[/size]
[font="Consolas"][color="#008080"][size="2"] $allrecords = array_merge([/size]

}

[/size]



I got it:
[size="3"]Cliente Before:[/size]


[size="3"]Server:[/size]

[size="3"]

[/size]


**

[size="3"]Client After:[/size]

[size="3"]

[/size]

**


[size="3"]App:[/size]

[size="3"]

[/size]


[size="3"]Result:[/size]

[size="3"]

[/size]


**

[size="3"]Great, thanks.... [/size]**