Concatenate db values on rows












-1















I'd like to concatenate this db values into one rows but i failed to do so. Can anyone help me regarding this problem? Thanks much!



         <tr>
<td><?php echo $i;$i++; ?></td>
<td><?php print($row['vfname'. " " & 'vmname' & " " & 'vlname']); ?></td>
<td><?php print($row['vage']); ?></td>
<td><?php print($row['vprecinct']); ?></td>
<td><?php print($row['vworkstat']); ?></td>
<td><?php print($row['vleaders']); ?></td>
<td><?php print($row['vclass']); ?></td>
<td><?php print($row['vaddress']); ?></td>
<td><?php print($row['vcontact']); ?></td>
<td><?php print($row['vdatereg']); ?></td>
</tr>









share|improve this question























  • $row["vfname"] is probably a value from your database. Whatever you've got there is not. & is a binary math operator...

    – miken32
    Nov 20 '18 at 2:26











  • each value needs to be accessed from the $row array -> print($row['vfname']." " .$row['vmname']." " .$row['vlname']);

    – Sean
    Nov 20 '18 at 3:34











  • already fixed it sir. i concat it in sql statement

    – Marvin Raymund Popioco
    Nov 21 '18 at 1:52
















-1















I'd like to concatenate this db values into one rows but i failed to do so. Can anyone help me regarding this problem? Thanks much!



         <tr>
<td><?php echo $i;$i++; ?></td>
<td><?php print($row['vfname'. " " & 'vmname' & " " & 'vlname']); ?></td>
<td><?php print($row['vage']); ?></td>
<td><?php print($row['vprecinct']); ?></td>
<td><?php print($row['vworkstat']); ?></td>
<td><?php print($row['vleaders']); ?></td>
<td><?php print($row['vclass']); ?></td>
<td><?php print($row['vaddress']); ?></td>
<td><?php print($row['vcontact']); ?></td>
<td><?php print($row['vdatereg']); ?></td>
</tr>









share|improve this question























  • $row["vfname"] is probably a value from your database. Whatever you've got there is not. & is a binary math operator...

    – miken32
    Nov 20 '18 at 2:26











  • each value needs to be accessed from the $row array -> print($row['vfname']." " .$row['vmname']." " .$row['vlname']);

    – Sean
    Nov 20 '18 at 3:34











  • already fixed it sir. i concat it in sql statement

    – Marvin Raymund Popioco
    Nov 21 '18 at 1:52














-1












-1








-1








I'd like to concatenate this db values into one rows but i failed to do so. Can anyone help me regarding this problem? Thanks much!



         <tr>
<td><?php echo $i;$i++; ?></td>
<td><?php print($row['vfname'. " " & 'vmname' & " " & 'vlname']); ?></td>
<td><?php print($row['vage']); ?></td>
<td><?php print($row['vprecinct']); ?></td>
<td><?php print($row['vworkstat']); ?></td>
<td><?php print($row['vleaders']); ?></td>
<td><?php print($row['vclass']); ?></td>
<td><?php print($row['vaddress']); ?></td>
<td><?php print($row['vcontact']); ?></td>
<td><?php print($row['vdatereg']); ?></td>
</tr>









share|improve this question














I'd like to concatenate this db values into one rows but i failed to do so. Can anyone help me regarding this problem? Thanks much!



         <tr>
<td><?php echo $i;$i++; ?></td>
<td><?php print($row['vfname'. " " & 'vmname' & " " & 'vlname']); ?></td>
<td><?php print($row['vage']); ?></td>
<td><?php print($row['vprecinct']); ?></td>
<td><?php print($row['vworkstat']); ?></td>
<td><?php print($row['vleaders']); ?></td>
<td><?php print($row['vclass']); ?></td>
<td><?php print($row['vaddress']); ?></td>
<td><?php print($row['vcontact']); ?></td>
<td><?php print($row['vdatereg']); ?></td>
</tr>






php rows concat






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 2:12









Marvin Raymund PopiocoMarvin Raymund Popioco

92




92













  • $row["vfname"] is probably a value from your database. Whatever you've got there is not. & is a binary math operator...

    – miken32
    Nov 20 '18 at 2:26











  • each value needs to be accessed from the $row array -> print($row['vfname']." " .$row['vmname']." " .$row['vlname']);

    – Sean
    Nov 20 '18 at 3:34











  • already fixed it sir. i concat it in sql statement

    – Marvin Raymund Popioco
    Nov 21 '18 at 1:52



















  • $row["vfname"] is probably a value from your database. Whatever you've got there is not. & is a binary math operator...

    – miken32
    Nov 20 '18 at 2:26











  • each value needs to be accessed from the $row array -> print($row['vfname']." " .$row['vmname']." " .$row['vlname']);

    – Sean
    Nov 20 '18 at 3:34











  • already fixed it sir. i concat it in sql statement

    – Marvin Raymund Popioco
    Nov 21 '18 at 1:52

















$row["vfname"] is probably a value from your database. Whatever you've got there is not. & is a binary math operator...

– miken32
Nov 20 '18 at 2:26





$row["vfname"] is probably a value from your database. Whatever you've got there is not. & is a binary math operator...

– miken32
Nov 20 '18 at 2:26













each value needs to be accessed from the $row array -> print($row['vfname']." " .$row['vmname']." " .$row['vlname']);

– Sean
Nov 20 '18 at 3:34





each value needs to be accessed from the $row array -> print($row['vfname']." " .$row['vmname']." " .$row['vlname']);

– Sean
Nov 20 '18 at 3:34













already fixed it sir. i concat it in sql statement

– Marvin Raymund Popioco
Nov 21 '18 at 1:52





already fixed it sir. i concat it in sql statement

– Marvin Raymund Popioco
Nov 21 '18 at 1:52












1 Answer
1






active

oldest

votes


















1














done. i concat it in the sql statement hope this will help anyone



$tablecontent = '';
$start = '';
$selectStmt = $con->prepare("SELECT vaddress, Concat(vfname, ' ', vmname, ' ', vlname) AS Name, vage, vcontact, vworkstat, vclass, vprecinct, vleaders, vdatereg FROM votersinfotbl ORDER BY vaddress ASC");
$selectStmt->execute();
$votersinfotbl = $selectStmt->fetchAll();





share|improve this answer
























  • Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

    – ivanivan
    Nov 21 '18 at 1:57











  • would you mind orient me on that way sir? so interested to learn a lot ways to do it.

    – Marvin Raymund Popioco
    Nov 21 '18 at 4:12











  • You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

    – ivanivan
    Nov 21 '18 at 4:19











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385255%2fconcatenate-db-values-on-rows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














done. i concat it in the sql statement hope this will help anyone



$tablecontent = '';
$start = '';
$selectStmt = $con->prepare("SELECT vaddress, Concat(vfname, ' ', vmname, ' ', vlname) AS Name, vage, vcontact, vworkstat, vclass, vprecinct, vleaders, vdatereg FROM votersinfotbl ORDER BY vaddress ASC");
$selectStmt->execute();
$votersinfotbl = $selectStmt->fetchAll();





share|improve this answer
























  • Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

    – ivanivan
    Nov 21 '18 at 1:57











  • would you mind orient me on that way sir? so interested to learn a lot ways to do it.

    – Marvin Raymund Popioco
    Nov 21 '18 at 4:12











  • You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

    – ivanivan
    Nov 21 '18 at 4:19
















1














done. i concat it in the sql statement hope this will help anyone



$tablecontent = '';
$start = '';
$selectStmt = $con->prepare("SELECT vaddress, Concat(vfname, ' ', vmname, ' ', vlname) AS Name, vage, vcontact, vworkstat, vclass, vprecinct, vleaders, vdatereg FROM votersinfotbl ORDER BY vaddress ASC");
$selectStmt->execute();
$votersinfotbl = $selectStmt->fetchAll();





share|improve this answer
























  • Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

    – ivanivan
    Nov 21 '18 at 1:57











  • would you mind orient me on that way sir? so interested to learn a lot ways to do it.

    – Marvin Raymund Popioco
    Nov 21 '18 at 4:12











  • You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

    – ivanivan
    Nov 21 '18 at 4:19














1












1








1







done. i concat it in the sql statement hope this will help anyone



$tablecontent = '';
$start = '';
$selectStmt = $con->prepare("SELECT vaddress, Concat(vfname, ' ', vmname, ' ', vlname) AS Name, vage, vcontact, vworkstat, vclass, vprecinct, vleaders, vdatereg FROM votersinfotbl ORDER BY vaddress ASC");
$selectStmt->execute();
$votersinfotbl = $selectStmt->fetchAll();





share|improve this answer













done. i concat it in the sql statement hope this will help anyone



$tablecontent = '';
$start = '';
$selectStmt = $con->prepare("SELECT vaddress, Concat(vfname, ' ', vmname, ' ', vlname) AS Name, vage, vcontact, vworkstat, vclass, vprecinct, vleaders, vdatereg FROM votersinfotbl ORDER BY vaddress ASC");
$selectStmt->execute();
$votersinfotbl = $selectStmt->fetchAll();






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 1:54









Marvin Raymund PopiocoMarvin Raymund Popioco

92




92













  • Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

    – ivanivan
    Nov 21 '18 at 1:57











  • would you mind orient me on that way sir? so interested to learn a lot ways to do it.

    – Marvin Raymund Popioco
    Nov 21 '18 at 4:12











  • You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

    – ivanivan
    Nov 21 '18 at 4:19



















  • Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

    – ivanivan
    Nov 21 '18 at 1:57











  • would you mind orient me on that way sir? so interested to learn a lot ways to do it.

    – Marvin Raymund Popioco
    Nov 21 '18 at 4:12











  • You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

    – ivanivan
    Nov 21 '18 at 4:19

















Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

– ivanivan
Nov 21 '18 at 1:57





Doing in a Better Tool (or more appropriate) is often the more efficient way anyway

– ivanivan
Nov 21 '18 at 1:57













would you mind orient me on that way sir? so interested to learn a lot ways to do it.

– Marvin Raymund Popioco
Nov 21 '18 at 4:12





would you mind orient me on that way sir? so interested to learn a lot ways to do it.

– Marvin Raymund Popioco
Nov 21 '18 at 4:12













You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

– ivanivan
Nov 21 '18 at 4:19





You've done it yourself using the concat() in SQL - although pulling the columns and appending the strings in the print statements would be just as quick. One of the good examples though is comparing results between a DB and an array. The array has to end up in a db eventually, so I put it there first and use the DB engine to compare the 2 tables vs looping through both massive arrays (50k records in each).

– ivanivan
Nov 21 '18 at 4:19


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385255%2fconcatenate-db-values-on-rows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?