Jump to content

the1h3r0

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by the1h3r0

  1. Okay so I'm trying to write a script that generates the MySQL code for a DayZ inventory using simple dropdowns. The code format for the mysql code is: [["primaryweapon","secondaryweapon"],["item1","item2",...etc]] I know how I'm going to use dropdown lists to fill in the primary and secondary weapons, but not so much for the items. All the items in DayZ will be in this one dropdown list and I want it to be so when you select which item you want and click an "Add Item" button it will echo a live output of the code so far. I'm not sure how to make it so the next item in the code is filled in properly all using one dropdown list. Is there any way of accomplishing this? Sorry if it's a bad explination as to what I need, I just really don't know how to describe it. Essentially I want it to look like this:
  2. Okay so my connection issue is solved. Now there's another problem. One function I want to add is giving a person a new custom loadout. This is done by connecting to the database, selecting the table, and inserting a row with a cust_loadout_id and a unique_id value which are taken from input forms on the previous page. When i run this function I get no errors at all, but when I check the database, there is no new entry. is it because cust_loadout_id has a primary key which is only a certain amount of values? if so, is there a way that when inputting the cust_loadout_id value there is a dropdown list that shows all the primary key values as opposed to a blank text form?
  3. how do i pass the connection into the function?
  4. like i said, i dont have access to do that. i just find it really strange that i almost had the script working (it connected to the database with no problems whatsoever) and now all the sudden i apparently have no access to the database at all.
  5. It just says Host 'ipgoeshere' is not allowed to connect to this MySQL server. But on the page before this error happens, that same IP *does* connect to the database and it pulls information into a table. So for some reason when I hit submit its not longer allowing access to the server...i think
  6. it would appear the host doesn't allow access to people creating new users. like i said, i had it working to the point where i could connect to the database with no problems. i just dont know what is causing that mysqli error when $con is obviously defined as a mysqli link when its saying its receiving null.
  7. and it's weird. sometimes i get the access denied error sometimes not. i did have it working earlier tonight but it was so buggy it wasn't worth* it. but i can definitely make successful connections from this host.
  8. is there a way to check this in phpmyadmin?
  9. I tried that and now I'm getting two errors. mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'dbuser'@'db' (using password: YES) and mysqli_query() expects parameter 1 to be mysqli, null again on line 49 this time.
  10. I've seen this error posted everywhere and no one's answers seem to pertain to mine. This is my code: <?php $password=$_POST['password']; $check=$_POST['checkid']; $con=mysqli_connect("db","dbuser","$password","db","3306"); //Gives player a new loadout function playerLoadout() { mysqli_query($con,"INSERT INTO cust_loadout_profile (cust_loadout_id, unique_id) VALUES ('$_POST[loadoutid]','$_POST[uniqueid]')"); } //Updates existing player's loadout function updateLoadout() { mysqli_query($con,"UPDATE cust_loadout_profile SET cust_loadout_id='$_POST[loadoutidchange]' WHERE unique_id='$_POST[uniqueidchange]'"); } //Creates new loadout function createLoadout() { mysqli_query($con,"INSERT INTO cust_loadout (id, inventory, backpack, description) VALUES ('$_POST[id]','$_POST[inventory]','$_POST[backpack]','$_POST[description]')"); } //Deletes selected loadout function deleteLoadout() { mysqli_query($con,"DELETE FROM cust_loadout WHERE id = '$_POST[iddelete]'"); } //Table that shows current loadouts mysql_connect("db","dbuser","password"); mysql_select_db("db"); $data = mysql_query("SELECT * FROM `cust_loadout_profile` WHERE `unique_id` = '$check' ") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { Print "Current Loadout: ".$info['cust_loadout_id'] . " "; } if (!empty($_POST['uniqueid'])) { playerLoadout(); } if (!empty($_POST['uniqueidchange'])) { updateLoadout(); } if (!empty($_POST['id'])) { createLoadout(); } if (!empty($_POST['iddelete'])) { deleteLoadout(); } ?> and the mysqli_query() expects parameter 1 to be mysqli, null given error occurs on line 28 which is this query: mysqli_query($con,"INSERT INTO cust_loadout (id, inventory, backpack, description) VALUES ('$_POST[id]','$_POST[inventory]','$_POST[backpack]','$_POST[description]')"); any ideas what is causing this error? $con is defined at the beginning of the code and it doesn't give me that error for the first two functions, just this third one.
×
×
  • 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.