Jump to content

[SOLVED] update in mysql


alin19

Recommended Posts

 

it was a comand that i can't find, with afected rows

 

$query="UPDATE test SET tra='$arr[0]', simbol='$arr[1]' WHERE tra='test'";

 

if

//afected row= 0 then

 

$query= "INSERT INTO `test` ( `id` , `tra` , `simbol` )

VALUES (

'', '$arr[0]', '$arr[2]')";

Link to comment
Share on other sites

$query="UPDATE test SET tra='$arr[0]', simbol='$arr[2]', piata='$arr[1]', bidvol='$arr[3]', bestbid='$arr[4]' , bestask='$arr[5]' , bidask='$arr[6]' , pret='$arr[8]' , volum='$arr[7]' , nrtra='$arr[9]' , data='$arr[10]' , var='$arr[11]' WHERE simbol='$arr[2]'";

 

 

if (mysql_query($query))

{

echo 'good';

}

else

{

echo 'bad';

}

 

--------if (int mysql_affected_rows ( (resource $link_identifier) )=0)

 

{

$query= "INSERT INTO `test` ( `id` , `tra` , `simbol` , `piata` , `bidvol` , `bestbid` , `bestask` , `bidask` , `pret` , `volum` , `nrtra` , `data` , `var` )

VALUES (

'', '$arr[0]', '$arr[2]', '$arr[1]', '$arr[3]', '$arr[4]', '$arr[5]', '$arr[6]', '$arr[8]', '$arr[7]', '$arr[9]' ,  '$arr[10]', '$arr[11]'

)";

}

 

 

 

i'm still geting an error  at that line:

 

PHP Parse error:  syntax error, unexpected T_VARIABLE  on line 42

Link to comment
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.