You could try to define the variable before the loop, e.g.
$report = "";
while ($row = mysql_fetch_array($result)) {
$report .= "a"."b".$row["prevDOCid"]+1;
}
echo $report;
I hope this helps you!
Edit Use .= not +=
More Related Contents:
- How do I iterate over the results in a MySQLi result set?
- PHP – Flushing While Loop Data with Ajax
- While loop within While loop not looping
- Sign in form always showing "Wrong Credentials"
- Prevent creating duplicate entries in PHP
- Loop or no loop? [closed]
- How does PHP ‘foreach’ actually work?
- When should I use ‘self’ over ‘$this’?
- Single result from database using mysqli
- Giving my function access to outside variable
- Can you ‘exit’ a loop in PHP?
- How to find the foreach index?
- mysqli_fetch_array while loop columns
- How do you remove an array element in a foreach loop?
- PHP read sub-directories and loop through files how to?
- PHP hierarchical array – Parents and childs
- Print time in 15-minute increments between two times in the same day
- Looping a multidimensional array in php
- FOR loop performance in PHP
- Foreach value from POST from form
- mysqli query results to show all rows
- Using json_encode on objects in PHP (regardless of scope)
- PHP foreach loop through multidimensional array [duplicate]
- Loop a multidimensional array and only print two specific column values per row
- Multiple index variables in PHP foreach loop
- for loop vs while loop vs foreach loop PHP
- Insert elements from one array (one-at-a-time) after every second element of another array (un-even zippering)
- php variable scope
- looping a SQL insert statement with dates
- How can I list data in sections by an ID, with a while loop in PHP? [closed]