Jump to content

help me out pls asp!


waijs

Recommended Posts

I have the php/mysql code below:

 

It is supposed to update a table column(parentidf) to the values of another column(productid) in the same table WHERE a colum(originalid) in the same table IS EQUAL TO values of column(productid).

Guys,am new to php/msql;pls help me out!

 

<html>

<head><title>Update product group table</title>

</head>

<body>

<?php

 

//a file for the database select and connection

include('incsec/connect.inc.php');

$sql = "SELECT * FROM tblproductgroups";

$result = mysql_query($sql);

 

while($myrow = mysql_fetch_row($result))

{

    //Get ParentIDF

    $parentgroupidf = $myrow['parentgroupidf'];

    $productgroupid = $myrow['productgroupid'];

 

    //query to find the original id where it is equal to the parentidf

    $sql2 = "SELECT * FROM tblproductgroups WHERE originalid = $parentgroupidf ;";

    $result2 = mysql_query($sql2);

    $sql3 = "UPDATE tblproductgroups SET parentgroupidf = $productgroupid ;";

    $result3 = mysql_query($sql3);

}

?>

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/135614-help-me-out-pls-asp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.