Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.