Hi is there a cleaner way to do this? (Mysqli fetch and preg
Posted: Wed May 27, 2015 9:04 am
Hi I have a function to replace some stuff from strings.
I do my mysqli prepare, execute, bind and store
then for fetch I do this
(Im thinking something like
Im not so good at the fetch command... maby
My code works but it is ugly solution
Thanks in advance
I do my mysqli prepare, execute, bind and store
then for fetch I do this
I know there must be a more elegant way than to having to name all strings for the cleanData function but I cannot get it to workwhile($row=$stmt->fetch()){
cleanData($ID);
cleanData($artnr);
cleanData($skapadav);
..
.
printf ("%d; %s; %s; %d; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %d; %s; %d; %s; %s; %s; %d; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %d; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %s; %d; %d; %s; %s; %s; %s; %s; %s; %s; %s; %s; \n", $ID, $artnr, $skapadav, ...and so on
}
(Im thinking something like
Code: Select all
while....{
$row = cleanData($row);
printf (...
}Code: Select all
while bla bla fetch_row($result) {
$result=cleanData($result);
printf...
}Thanks in advance