FAILED TO INSERT DATA FROM FUNCTION();

FAILED TO INSERT DATA FROM FUNCTION();

HELLO, I HAVE A PROBLEM TO INSERT DATA FROM OUTPUT FROM FUNCTION()... I WANT TO STORE THE OUTPUT IN DATABASE, BUT FAILED TO INSERT...

before this....

.........................

function totalMac_ac1(){

$query1 = "SELECT AVG(MAC) FROM academia1";

$result1 = mysqlquery($query1) or die(mysqlerror());

while($row1 = mysqlfetcharray($result1)){

echo "".number_format($row1['AVG(MAC)'],1);

$sql = "INSERT INTO fkpacademia (MAC) VALUES ('$row1['AVG(MAC)']')";

$result=mysql_query($sql);

} } ..........................

just now i have this,

bigTotal.php

function bigMac_ac1(){

$sql = "INSERT INTO fkpacademia (MAC) VALUES ('$row1['AVG(MAC)']')";

$result=mysql_query($sql);

$query1a = "SELECT AVG(MAC) FROM fkpacademia";

$result1a = mysqlquery($query1a) or die(mysqlerror());

while($row1 = mysqlfetcharray($result1a)){

echo "".number_format($row1['AVG(MAC)'],1);

} }

fkpacademia.php

problem: no data store in table fkpacademia..

please somenone help me where the wrong...

View Answers

March 22, 2011 at 12:50 PM

$sqll = "UPDATE fkpacademia SET MAC = '$NUM' WHERE BIL='$BIL' "; $result=mysql_query($sqll);

anyone, data above will be updated, after next to next row.. i want it updated from their row only... like i want to set, $NUM1 = $BIL1, $NUM2 = $BIL2, something like that... how can i do that..?

i'm beginner in programming...









Related Tutorials/Questions & Answers:

Ads