Update issue - more then likely simple problem
| From: | Eric Holmstrom | Date: | Thu, 18 Dec 2003 02:39:57 +0000 |
| Subject: | Update issue - more then likely simple problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-172922@lists.php.net to get a copy of this message | ||
Hi there,
What im trying to do is read the information from a field in a table called
PARTNO. Then add RU to the front of whatever is in the PARTNO field.
So far i have this.
//connect details rarara
//query
$query= "SELECT PARTNO FROM russell2 ";
// make a query to get old stuff from DB col
$oldstuff = mysql_query($query, $conn) or die(mysql_error());
while ($new = mysql_fetch_array($oldstuff)){
$final = $new['PARTNO'];
//new infomation i want to add infront of PARTNO data
$newstuff = 'RU';
//Combining the two resluts together
$results = $newstuff.$final;
// just use this to check it was going through properly
print_r($results<br>);
}
The problem i have to get it to update. If i add this (see below) inside the
while statement it continually loops, and outside it doesnt work.
$update = "UPDATE rocket SET PARTNO = '$results''";
mysql_query($update);
I know the answer is simple but i seem to be stuck on it.
Thankyou
Eric Holmstrom