Database not working here?


#21

Hi @PachiMc!

hi idk whyy my db is not working, i am using localhost where al worked, then i recreated the db and changed the db.php but is not working,

Please copy/paste the error you are receiving when attempting to connect to database.


EDIT: I have just checked your code and it connects to the database successfully.

Note to use $link variable in order to connect to DB inside your main scripts. Use global keyword to access it inside functions.

Also, next time you want to debug PHP errors, please add php_value display_errors 1 in .htaccess file. If you don’t have such file created yet in your website root, please create one.


#22

yea but i dont want to debug,still without working, i use requiere db.php and then $link do yyou think that i should use $_globals[link] ? because on localhost worked without it btw i am not using functions


#23

Now it wasn’t working because you had created anther database… I have updated the info in db.php.

Please try running your code again. If it still doesn’t work, please point us the scripts and the lines where it fails.


#24

still without inserting nothing ;(


#25

What is the script which inserts info into database?


#26

you can see send.php there is a lot of inserts and updates


#27

I have performed a test which inserted data into database successfully. It has to be a syntax error somewhere.

@Supun @ckhawand , can you check out the send.php at nenez.cf in /public_html?


#28

Will do check, but where is the form that sends those info?


#29

is in index, with a jquery button called “contact” method get


#30

I can’t see it :confused:


#32
<form method="GET" action="send.php" id="form1">
<i id="closeb" class="fas fa-times"></i>

  <label class="formtext" for="steamid">Tu SteamID</label>
<input class="inputform" name="steamidname" readonly id="steamid" type="number" value="<?php echo($steamprofile['steamid']) ?>">
  <label class="formtext" for="mens">Mensaje</label>
<textarea required rows="3" cols="50" name="mens" class="inputform" placeholder="Cuentanos..." id="mens"></textarea>
<input  id="submitform" type="submit">

</form>

#33

that is the html code !


#34

I meant, I see error messages on the index :slight_smile:


#35

what you mean where is the error ?


#36

first will have error because you are not logged in so the db cant create your id after your sign in if your db work (thats dont) should create all without errors


#37

I’d check later :slight_smile:


#38

so ?.. -.- i cant upgrade on my code if the sql dont work ;(


#39

Actually it is for sure an error in your SQL syntax :slight_smile:
I’d recommend checking the experts at stackoverflow.com


#40

well, if is a sql syntax error the code shouldnt work on localhost, or console of phpmyadmin,

here is an example
id64 is get from $steamau = require('userInfo.php');

$id64 = $steamprofile['steamid'];
$create = "INSERT INTO inventario (user) VALUES ('$id64')";

		 mysqli_query($link, $create);

from the session

$steamprofile['steamid'] = $_SESSION['steam_steamid'];

from the openid

$_SESSION['steam_steamid'] = $content['response']['players'][0]['steamid'];

there isnt error ;(


#41

Can you downgrade your PHP version?
And check if you have a tmp in the same directory as public_html