here my code -
if($pin == '105') {
$sqltree = "INSERT INTO tbltree (`userId`, `level`, `superId`, `rootId`, `childcount`)
VALUES ('$child1', '1', '$newid', '$myroot', '0');";
mysql_query($sqltree);
update_level($newid);
}
function update_level()
{
//for 1st level
$newid = $_SESSION['newid'];
//getting senior's level 1 and to increase by 1
$sqlgetlevel = "SELECT superId,level1 FROM tbltree WHERE userID='$newid'";
echo "<br>test:".$sqlgetlevel;
$result = mysql_query($sqlgetlevel,$link)or die(mysql_error()); //line 340
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$level1 = $row["level1"];
$level1 = $level1 + 1;
//update increased level
$sqlupdate = "UPDATE tbltree SET level1='$level1' WHERE userId='$newid';";
mysql_query($sqlupdate,$link)or die(mysql_error());
//change superId for new level
$superid = $row["superId"];
}
ERROR - test:SELECT superId,level1 FROM tbltree WHERE userID='29277640'
Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xampp\htdocs\303\levelupdate.php on line 340