This topic is locked

Update Master

11/17/2008 11:51:14 AM
PHPRunner General questions
P
paxys author

Hi from Italy <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=10181&image=1&table=forumtopics' class='bbcemoticon' alt='<<' />

Sorry for my english someone can help me?
I have two tables

master child
tblMod tblMatmod
Id (autoincrement) Id(Autoincrement)

Prezzo IdMod


Costo

  • Id = Idmod

    so when i add a new record in tblMatmod i want to update the master Prezzo
    i tried to use in after record added / update the following
    global $conn;
    $ad=$values["Costo"];
    $strUpdate = "update mod set `Prezzo`=`Prezzo`+

    ".$ad." where Id ='".$values['idmod']."'";
    db_exec($strUpdate,$conn);
    echo $strUpdate;
    the result is:
    update mod set `Prezzo`=`Prezzo`+ 5 where Id =''
    if i use
    where Id ='".$data['idmod']."'";
    the result is:
    Undefined variable: data
    if i use
    where Id ='1'";
    work 100%
    thanks

J
Jane 11/18/2008

Hi,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

P
paxys author 11/18/2008

Hi,

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.


Hi

thanks for the reply I solved this way
global $conn;

$str = "select * from matmodelli";

$rs = db_query($str,$conn);

$data = db_fetch_numarray($rs);

$ad=$values["Costo"];

$strUpdate = "update mod set `Prezzo`=`Prezzo`+ ".$no." where id =".$data[1]."";

db_exec($strUpdate,$conn);