Web Analytics Made Easy -
StatCounter limiting record insertions using variables - CodingForum

Announcement

Collapse
No announcement yet.

limiting record insertions using variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • limiting record insertions using variables

    I have a field named quanity that is populated from a paypal ipn with a quanity. That Number becomes a variable assigned to a user that limits the number of records he can enter into table recipients.

    I currently enter that quanity of records with NULL in all fields except for ownid (which is linked to id in table mydetails)
    I would prefer that the user just be able to add records until the limit is reached, then the add button should disappear.


    is this possible?


    More along the same line
    also poplulated from the paypal ipn are the fields cosponsor and clients
    if the cosponsor field is 1 or yes i want to automatically add one record to the cosponsor table and give user edit permissions.
    if the clints field is 1 or yes, then the user should have add edit delete permissions to that table. If it is not checked he should not see anything and same with clients.


    Below is my feeble attempt. Please help!


    <?php

    //Define the max entries allowed
    $value = $data["recipients"];

    $res=$value;

    $res=mysql_query('SELECT recipients FROM mydetails WHERE id = $userid') or die(mysql_error());
    $totalrecords=mysql_num_rows($res);
    if($totalrecords<=$res)
    { allow insert}
    else {remove buttons}


    ?>
    <?php

    //Did user buy clients?
    $value = $data["clients"];
    $res=$value;
    $res=mysql_query('select clients from mydetails where id = $userid') or die(mysql_error());
    $result=$res;
    if($res='1')
    { allow insert}
    else {remove buttons}


    ?>
    <?php

    //Did user buy cospsonsor?
    $value = $data["cospsonsor"];
    $res=$value;
    $res=mysql_query('SELECT cosponsor FROM mydetails WHERE id = $userid') or die(mysql_error());
    $totalrecords=mysql_num_rows($res);
    if($totalrecords<=$res)
    { allow insert}
    else {remove buttons}



    ?>
Working...
X
😀
🥰
🤢
😎
😡
👍
👎