Jump to content
Maintenance ×
×
×
  • Create New...
  • 0

Error itemshop add item


zeimpekis9

Question

19 answers to this question

Recommended Posts

  • 0
  • Honorable Member

Maybe because it's SQL? :D

 

Your current query should look like this:

INSERT INTO workorders VALUES ($column1, $column2);

so you have to add "(column1, column2)" to it.

INSERT INTO workorders (column1, column2) VALUES ($column1, $column2)

 

Replace column1/column2/... with your columns of your table in which you want to insert the values. If you need more help please post your php code.

Link to comment
Share on other sites

  • 0
2 minutes ago, .PolluX said:

Maybe because it's SQL? :D

 

Your current query should look like this:

INSERT INTO workorders VALUES ($column1, $column2);

so you have to add "(column1, column2)" to it.

INSERT INTO workorders (column1, column2) VALUES ($column1, $column2)

 

Replace column1/column2/... with your columns of your table in which you want to insert the values. If you need more help please post your php code.

This is it.

This is the hidden content, please

Link to comment
Share on other sites

  • 0
  • Honorable Member

When you're an administrator and want to download an attachment and the forum shows you...

The page you are trying to access is not available for your account. 

 

Could you please post it inside a code tag or put it on pastebin.com?

Link to comment
Share on other sites

  • 0
  • Honorable Member

Replace line 48-51

$sqlCmd="INSERT INTO ".SQL_HP_DB.".is_items
          (vnum, kategorie_id, bild, beschreibung, preis, anzeigen, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, socket0, socket1, socket2)
          VALUES
          ('".$inVnum."','".$inKategorie."','".$bildDatei."','".$inBeschreibung."','".$inPreis."','".$inAnzeigen."','".$boni0."', '".$boniv0."', '".$boni1."', '".$boniv1."', '".$boni2."', '".$boniv2."', '".$boni3."', '".$boniv3."', '".$boni4."', '".$boni4."', '".$boni5."', '".$boniv5."', '".$boni6."', '".$boniv6."', '".$socket0."', '".$socket1."', '".$socket1."')";

with

$sqlCmd="INSERT INTO ".SQL_HP_DB.".is_items
          (kategorie_id, bild, beschreibung, preis, anzeigen, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, socket0, socket1, socket2)
          VALUES
          ('".$inKategorie."','".$bildDatei."','".$inBeschreibung."','".$inPreis."','".$inAnzeigen."','".$boni0."', '".$boniv0."', '".$boni1."', '".$boniv1."', '".$boni2."', '".$boniv2."', '".$boni3."', '".$boniv3."', '".$boni4."', '".$boni4."', '".$boni5."', '".$boniv5."', '".$boni6."', '".$boniv6."', '".$socket0."', '".$socket1."', '".$socket1."')";

and try again.

Link to comment
Share on other sites

  • 0
8 minutes ago, .PolluX said:

 

8 minutes ago, .PolluX said:

Replace line 48-51

$sqlCmd="INSERT INTO ".SQL_HP_DB.".is_items
          (vnum, kategorie_id, bild, beschreibung, preis, anzeigen, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, socket0, socket1, socket2)
          VALUES
          ('".$inVnum."','".$inKategorie."','".$bildDatei."','".$inBeschreibung."','".$inPreis."','".$inAnzeigen."','".$boni0."', '".$boniv0."', '".$boni1."', '".$boniv1."', '".$boni2."', '".$boniv2."', '".$boni3."', '".$boniv3."', '".$boni4."', '".$boni4."', '".$boni5."', '".$boniv5."', '".$boni6."', '".$boniv6."', '".$socket0."', '".$socket1."', '".$socket1."')";

with

$sqlCmd="INSERT INTO ".SQL_HP_DB.".is_items
          (kategorie_id, bild, beschreibung, preis, anzeigen, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, socket0, socket1, socket2)
          VALUES
          ('".$inKategorie."','".$bildDatei."','".$inBeschreibung."','".$inPreis."','".$inAnzeigen."','".$boni0."', '".$boniv0."', '".$boni1."', '".$boniv1."', '".$boni2."', '".$boniv2."', '".$boni3."', '".$boniv3."', '".$boni4."', '".$boni4."', '".$boni5."', '".$boniv5."', '".$boni6."', '".$boniv6."', '".$socket0."', '".$socket1."', '".$socket1."')";

and try again.

This error is because i try to add items into itemshop. Now i don't get an error but the item not added. Can you help me?

Link to comment
Share on other sites

  • 0
  • Honorable Member

Check if your table "is_items" has a field "vnum" with AUTO_INCREMENT flag enabled.

 

Additionally add

ini_set('display_errors', 1);

on line 2, over

error_reporting(E_ALL);

 

to check if there really isn't any php error.

 

Then replace on line 53

if($inSql) echo'<p class="meldung">Item erfolgreich in den Itemshop eingef&uuml;gt.</p>';

with

if($inSql){
	echo'<p class="meldung">Item erfolgreich in den Itemshop eingefügt.</p>';
}else{
	echo mysql_errno($sqlHp) . ": " . mysql_error($sqlHp) . "\n";
}

and run the script again.

Link to comment
Share on other sites

  • 0

ok i just didnt read the whole code section but i noticed something wrong so please fix that first:

$boni0 = ($_POST['boni0']>=0 && $_POST['boni0']<=255) ? $_POST['boni0'] : '0';
$boni1 = ($_POST['boni1']>=0 && $_POST['boni1']<=255) ? $_POST['boni1'] : '0';
$boni2 = ($_POST['boni2']>=0 && $_POST['boni2']<=255) ? $_POST['boni2'] : '0';
$boni3 = ($_POST['boni3']>=0 && $_POST['boni3']<=255) ? $_POST['boni3'] : '0';
$boni4 = ($_POST['boni4']>=0 && $_POST['boni4']<=255) ? $_POST['boni4'] : '0';
$boni5 = ($_POST['boni5']>=0 && $_POST['boni5']<=255) ? $_POST['boni5'] : '0';
$boni6 = ($_POST['boni6']>=0 && $_POST['boni6']<=255) ? $_POST['boni6'] : '0';

in this if statements is the else part not an integer because you put 0 into '0'. Try it like this:

$boni0 = ($_POST['boni0']>=0 && $_POST['boni0']<=255) ? $_POST['boni0'] : 0;
$boni1 = ($_POST['boni1']>=0 && $_POST['boni1']<=255) ? $_POST['boni1'] : 0;
$boni2 = ($_POST['boni2']>=0 && $_POST['boni2']<=255) ? $_POST['boni2'] : 0;
$boni3 = ($_POST['boni3']>=0 && $_POST['boni3']<=255) ? $_POST['boni3'] : 0;
$boni4 = ($_POST['boni4']>=0 && $_POST['boni4']<=255) ? $_POST['boni4'] : 0;
$boni5 = ($_POST['boni5']>=0 && $_POST['boni5']<=255) ? $_POST['boni5'] : 0;
$boni6 = ($_POST['boni6']>=0 && $_POST['boni6']<=255) ? $_POST['boni6'] : 0;

same for $boniv0, $boniv1, $boniv2, $boniv3, $boniv4, $boniv5 and $boniv6

you can check every input with this to avoid strings:

var_dump(is_int($var));

Link to comment
Share on other sites

  • 0
3 minutes ago, Ayaka said:

ok i just didnt read the whole code section but i noticed something wrong so please fix that first:

$boni0 = ($_POST['boni0']>=0 && $_POST['boni0']<=255) ? $_POST['boni0'] : '0';
$boni1 = ($_POST['boni1']>=0 && $_POST['boni1']<=255) ? $_POST['boni1'] : '0';
$boni2 = ($_POST['boni2']>=0 && $_POST['boni2']<=255) ? $_POST['boni2'] : '0';
$boni3 = ($_POST['boni3']>=0 && $_POST['boni3']<=255) ? $_POST['boni3'] : '0';
$boni4 = ($_POST['boni4']>=0 && $_POST['boni4']<=255) ? $_POST['boni4'] : '0';
$boni5 = ($_POST['boni5']>=0 && $_POST['boni5']<=255) ? $_POST['boni5'] : '0';
$boni6 = ($_POST['boni6']>=0 && $_POST['boni6']<=255) ? $_POST['boni6'] : '0';

in this if statements is the else part not an integer because you put 0 into '0'. Try it like this:

$boni0 = ($_POST['boni0']>=0 && $_POST['boni0']<=255) ? $_POST['boni0'] : 0;
$boni1 = ($_POST['boni1']>=0 && $_POST['boni1']<=255) ? $_POST['boni1'] : 0;
$boni2 = ($_POST['boni2']>=0 && $_POST['boni2']<=255) ? $_POST['boni2'] : 0;
$boni3 = ($_POST['boni3']>=0 && $_POST['boni3']<=255) ? $_POST['boni3'] : 0;
$boni4 = ($_POST['boni4']>=0 && $_POST['boni4']<=255) ? $_POST['boni4'] : 0;
$boni5 = ($_POST['boni5']>=0 && $_POST['boni5']<=255) ? $_POST['boni5'] : 0;
$boni6 = ($_POST['boni6']>=0 && $_POST['boni6']<=255) ? $_POST['boni6'] : 0;

 

I did what you said but again the same. Nothing happens.

Link to comment
Share on other sites

  • 0

Problem solved. It was the variable type. if someone else will have this problem be sure to convert all variables into integer if your column type is int! 

/* you can to that this way */
intval($var);
/* or like this */
(int)$var

PS: Keep in mind that .PolluX was removing the value for vnum in the query, which was AUTO_INCREMENT and part of fixing this issue: 

 

  • Love 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Activity

    1. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    2. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    3. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    4. 0

      Some mobs dont drop items

    5. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    6. 691

      [Group] Daily Music - Share your favorite!

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.