This topic is locked
[SOLVED]

 Allow deletion based on a value of a different field and decrementng t

12/14/2010 1:40:56 PM
PHPRunner General questions
D
Death author

Hi,
I am currently evaluating PHPRunner and am a total newbie.
What I need to do:
A user can delete another user's message by clicking a button if he has a positive value in a field called "Deletions".
After he deleted a message the field "Deletions" needs to be decremented (and updated in the database) and if smaller than 0 set to 0.
If he has 0 in the "Deletion" field he cannot delete the message and a window should pop up telling him so.(and of course, no change in the "Deletion" field should happen)
The message is in a table called "messages" and named "message", the "Deletions" field is in a table called "user".
I have no clue on where and how to do this, any help/code would be more than appreciated....
TIA

D
Death author 12/14/2010

Anybody?

C
chaintm 12/15/2010

Well the reason I think you don't have a response is based upon the question you are asking or at least the way you are asking it. I use the user ID to identfy whom has what rights in a system.. excample...
$pos = strpos($data["towho"], $_SESSION["UserID"]);

if ($data["employee"]==$_SESSION["OwnerID"] || !($pos===false))

{

//show it

}

else

{

$record["edit_link"] = false;

$record["checkbox"] = false;

//Hide it
I use user ID's to do this and hide and show links as well. hiding and showing values on a page in the excample above. You can also use the ownership values to allow how has access to what. There are many ways to go about what you are asking, thou I am not to clear on what you really want other then locking out people without permissions. In this case the above works easy enough. Hope that helps. As far as deleting records, backing them up , you will chain your events within the event editor. for excample once you do the above in after record process (if on the list page) you could then add such commands as ...
$strUpdate = "Update CAT set CAT_dat ='9'where CAT_id =".$_SESSION[$strTableName."_masterkey1"];

db_exec($strUpdate,$conn);
in that excample I update a post in a forum with a key number, that number refrences to another table in my database for other functions. Again really being clear on what you want would help. Also, phprunner is a great peice of software and saves a developer a ton of time and even those that are not even in the know about coding. But once you break out of the basic inventory concepts that the system was designed upon and go into customizations such as chat system etc... it can get a bit daunting as they leave it very flexiable for developers to change in anyway they need it.
This flexiabilty comes with a price ofcourse and that is the more you allow for customization the harder it is to make it a click of a button to have something happen for you automaticlly. They update with new editions and improve on it yearly. Some good , some bad, but still the best editor out their to date. GL!

D
Death author 12/15/2010

Thanx for the response, really appreciated!
What I have is a table "users" and a table "messages". In the user table is a field "Deletions" and in the messages table is a field "message".
I would like for a person to be able to delete a "message" field, if he has a positive number in the "Deletions" field (him being the current user and the "Deletions" field is his, while the message field may be anybody's)
If he doesn't have a positive number in his "Deletions" field (i.e. 0 or less) then he cannot delete that "message".
This should be a button which shows on a messages list (next to the edit or view icon) only if his "Deletions" field is greater than 0.
If it is greater than 0 then he can delete this "message", if not, it should pop-up a window (or text message) stating that he doesn't have enough deletion points.
I hope that makes more sense,
thanx again for any help

C
chaintm 12/15/2010

oh ya allot easier,
you want to base off of a num value simple enough, use the lesser or greater statement in your before process on the events area.
basicly you could use something like ...
if($oldvalues["Deletions"]<=0)

{

//show it

}

else

{

//Hide it
The show it or hide it is where you would put the code for the deletion field, not sure what you have it set as, but I would just set it as the default del for the system in the listings page. if that is the case...
if($oldvalues["Deletions"]<=0)

{

//show it

}

else

{

$record["del_link"] = false;

//Hide it
again all depends on the version you are using, in the editor you could click on the item (or link) you want to not show , then on top their is the HMTL editor , hit that , what you clicked on prior should be highlited, that name can go where the "del_link" name is. IE check_box or whatever it says. That is the simple way to do it. but again, so many ways to go about it, it really comes down to knowing how to code in general. Off hand I have done such system 5 different ways and that's just off my head. It really again all depends what the total system entails and what the main goal is. Sadly and obviously I can't write all that code for you, but if are descent with coding this should be easy enough. If you are truly new to this and are just looking for a good chat (forum ) system that is user friendly. Go with pre-coded stuff like phpbb. http://www.phpbb.com/ , easy to use a bit hard to install on a server but once up, very easy for friendly designing , administration etc. GL!
Edit: btw if your looking to change that value as well, this doesn't cover that , that would but a whole other section to make "deletions" a value. I am assuming you have that value allready changing.

D
Death author 12/15/2010

Thanx again, you da man!
However I haven't done any code whatsoever, because I really don't know how to do any of it. I don't know how to do PHP or JavaScript, so what I really need is a step by step. If you would take the time to explain what to do where, one step at a time I should be able to follow that.
You have no idea how much I appreciate your help, thanx again!

C
chaintm 12/15/2010



Thanx again, you da man!
However I haven't done any code whatsoever, because I really don't know how to do any of it. I don't know how to do PHP or JavaScript, so what I really need is a step by step. If you would take the time to explain what to do where, one step at a time I should be able to follow that.
You have no idea how much I appreciate your help, thanx again!


well because this would take basicly all my code from a project I rather not release that , however I can point you in the right direction. First off, Phprunner is great way to really get a good concept of how to code. I suggest the following you can buy it or get assistance to do so... buy the following...
-Navicat for Mysql (best sql interface system out there , easy to learn, helping hand, best ! around 40 bucks)

-phprunner (best editor for basicly anything to do with editing all code to make a database type of website/interface/inventorysystem you name it)

  • 1 buy ... book for dummies!



    No insult at all actually, but the book for dummies series (if you are serious about learning ) is a great place to start. If you got php coding for dummies thats a great start. Also I recommend
    -24hrSQL or 24hrsMYSQL book... basicly in 24hrs you will understand and be dangerous enough to comprehend how to deal with sql or mysql.
    Finally the hardest thing for most people is getting the servers setup with the correct settings. A great book for this is..
    The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and PHP
    ya, dreamweaver I know, but being in this industry for over 30 years, I have found that these books listed have helped the most people I know become top coders.
    GL to you!



D
Death author 12/15/2010

Well, thanx again for the info,

but I really need this solved before the trial expires. If I can't do it with PHPRunner, I'll have to try something else. A friend suggested another software (much more expensive but needs only one language to be learned to be used).

I can't pick up PHP, JS PHPrunner all in one swoop in a few days, that looks like a much longer term process...
Too bad, I really liked what I have seen so far, it is really easy to use, but then the customization seems to require to know all of the above and then some. I don't even know which variables are available when and reading through the board, that seems to be a major issue with a lot of users. 21 days (with only weekends to "play" with the trial edition) is too short to get anything of substance done.
Anyway, maybe the administrator helps me out before this won't run anymore. Can't buy, if I can't get the answers and make it work...
However, I really appreciate your trying to help out and having taking the time to respond, thanx again!

P
procheck 12/15/2010

I think that you're trying to run before you can walk. What chaintm suggests is excellent. Another great book

is the SAMs series of books (Sams Teach Yourself PHP, MySQL and Apache All in One)
http://www.ebook3000.com/Sams-Teach-Yourself-PHP--MySQL-and-Apache-All-in-One--2nd-Edition-_21267.html
These books will show you step by step how to setup PHP, APACHE & MySQL on your pc and it even comes with an install CD

so you don't need to download them from the various sites. It will show you how to configure your php.ini and how to get

started with connnecting to MySQL and PHP coding.
As far as the trial is concerned, maybe Sergey can suggest something.

D
Death author 12/15/2010

Thanx for the info, the book link doesn't work and the button links to some .exe file... (might be a virus?)
Well, it looks like I won't be able to use PHPRunner for this and the trial runs out tomorrow anyway.
Thanx for trying to help though, it was really appreciated.

Sergey Kornilov admin 12/16/2010

Death,
I would suggest to contact support directly http://support.xlinesoft.com so we can arrange some kind of deal.

D
Death author 12/16/2010



Death,
I would suggest to contact support directly http://support.xlinesoft.com so we can arrange some kind of deal.


Not sure what you want me to do at that page... Do you want me to set up a ticket?
All I need is a few lines of code from someone who knows how to do it.

A button that reads a field, if it is greater than zero decrements that field and deletes the current message, otherwise it should display "Sorry you don't have any Deletions left"
It can't be too tough for the experts...
Or is it just not possible? (It seems that nobody has the answers to the problem posed.)
I really liked PHPRunner and the way it works, but it seems that customization is a hard nut to crack for those who don't have JS & PHP experience.
Anyway, my trial ran out, so all of this is hypothetical...
Thank all of you for trying to supply an answer and taking time out of your busy days to look at newbie's problems, I really appreciated it.

Sergey Kornilov admin 12/16/2010

Why don't you just follow my suggestion? There is no need to ask question about asking a question. There are things that cannot be posted to public forum.

P
procheck 12/16/2010

I think Sergey just suggested sending them an email but they usually prefer a ticket opened to keep track.

The link I provided works just fine but it was just an example. Simply search on "Sams Teach Yourself PHP, MySQL and Apache All in One".

No software can do the customization for you. PHPRunner will create you a nice basic website with no knowledge of PHP.

This forum can help you get over difficult problems and a lot more but you also need to take a course or maybe hire a programmer to help you out.