Jump to content

Needing Some help


chinclub

Recommended Posts

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.