chinclub Posted April 2, 2007 Share Posted April 2, 2007 Hello everyone. I am new to this forum and I hope I am placing this in the right place. I have purchased a virtual pet script and I am trying to tweak it just a little. Unfortunately it is written in PHP and I am not all that educated in it. All of my other scripts are cgi. Anyway, I have updated the PHP file all but one place and it keeps giving me an error in that section. I think I know what I need it to say but its one of those else... if things and I am not sure how to add the code I need. Is there anyone here that would be willing to help? The file I am working with adds items to the virtual store. It currently will only add item types for weapons, x, and food. x & weapons are both treated as items in the database and are only differentiated in the "type" field of the available_items database. Food gets its own available_food database. I am wanting to add another type to the food category for actions. I have named it chaction to be sure I don't mess up any possible action code. I want to add it to the food category so that it will disappear after you "use" it. The available_items are kept by the animals forever. So, I have added the "type" field to the available_food database and I have changed all of the code in the attached file to include type "chaction". As it is attached it doesn't give an error when loaded, however it is now calling all food chaction instead of differentiating between it as it is added. I am sure that the part of the file I am missing is here: if(rename($add,$newname)) { if($type == "x" || $type == "weapon") { if($type=="x") { $type = ""; } if($library == 1) { $inserta = mysql_query("INSERT INTO `library_items` (`user`, `item`, `name`, `cost`, `points`, `type`, `damage`) VALUES(\"$user\", \"$file_name\", \"$name\", '$cost', '$points', '$type', '$damage')"); if(!$inserta) { print "<b>Cant insert into library</b><p>" . mysql_error(); } } $sql = mysql_query("INSERT INTO `available_items` (`site`, `user`, `item`, `name`, `cost`, `points`, `type`, `damage`) VALUES(\"$V\", '1', \"$file_name\", \"$name\", '$cost', '$points', '$type', '$damage')"); } else { if($library == 1) { $inserta = mysql_query("INSERT INTO `library_food` (`user`, `item`, `name`, `cost`, `points`, `type`) VALUES(\"$user\", \"$file_name\", \"$name\", '$cost', '$points', '$type')"); if(!$inserta) { print "<b>Cant insert into library</b><p>" . mysql_error(); } } $sql = mysql_query("INSERT INTO `available_food` (`site`, `user`, `name`, `cost`, `points`, `type`, `item`) VALUES(\"$V\", '1', \"$name\", '$cost', '$points', '$type', \"$file_name\")"); } I believe that somewhere in there I have to add something like: if($type == "food" || $type == "chaction") { if($type=="x") { $type = ""; However I can't figure out how to add it. I am hoping I have explained this OK and that someone might be able to help me with this. I am also hoping that I am on the right track in editing this script. I am attaching the complete .PHP file (already editted for the new chaction with exception of what I said above) also in case I have missed something else. Thanks so much to anyone who can help! [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
chinclub Posted April 2, 2007 Author Share Posted April 2, 2007 Oops, I think I should have posted this in the 3rd party scripts section. I apologize for the error. Quote Link to comment Share on other sites More sharing options...
chinclub Posted April 2, 2007 Author Share Posted April 2, 2007 Bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.