Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick question about reading and modifying a record.

Status
Not open for further replies.

kjspear

Programmer
Feb 13, 2002
173
US
Hello everyone!

I have a quick question. Can MySql do both retrive records and modify the values in them at the same time? For example, the code below reads records one at a time on the screen.

$db=mysql_connect("mycomputer","yourname","")
or die("Could not connect : " . mysql_error());
mysql_pconnect();
mysql_select_db("mytable") or die("Could not select database");


$query = ("SELECT * FROM myimagexx where ID=$count");

$result = mysql_query($query) or die("Query failed : " . mysql_error());
$num_rows = mysql_num_rows($result);

if ($v5=5){;
$sql = "INSERT INTO `myimagexx` (`v5`) VALUES ('" . $v5. "')";
}



echo "$num_rows Rows\n";

while ($row= mysql_fetch_array($result))

//I used the sessions command increment the page visit by //one for the $count varible. It works fine for retriving records one at a time on screen. What I really want to do is not add records but to modify one. So lets say, 'v5' was 1 it was changed to 2.

Please let me know if you need more information.

Thanks
KJ



 
O.K. I was afraid of that. I'm going to try something else. I'll let you know the results.

Thanks
KJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top