Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Need help with website mysql errors :(

Initiate Mage
Joined
Oct 9, 2015
Messages
1
Reaction score
0
Hi guys, basically. I've just started learning website coding & i bought a source from someone i know. He promised that there won't be any errors and it'll be usable after setting it up. However, sad to say there's a few errors after setting it up. Basically, my website is a CSGO Jackpot website, if it's possible. Please help me on solving these problems, thanks!!

Error 1) mysql_query(): Unknown column 'steamprofile' in 'field list' on line 9
Error 2) mysql_fetch_assoc() expects parameter 1 to be resource, boolean given on line 10.


<?php (LINE 1)
$sitename ="www.xxx.com";(LINE 2)
$link = mysql_connect("ip","root","password");(LINE 3)
$db_selected = mysql_select_db('database',$link);(LINE 4)
mysql_query
("SET NAMES utf8");(LINE 5)

function fetchinfo($rowname,$tablename,$finder,$findervalue){(LINE 7)
if($finder =="1")$result = mysql_query("SELECT $rowname FROM $tablename");(LINE 8)
else$result = mysql_query("SELECT $rowname FROM $tablename WHERE `$finder`='$findervalue'");(LINE 9)
$row= mysql_fetch_assoc($result);(LINE 10)
return$row[$rowname];(LINE 11)
}
?>


If this isn't enough to solve the problem, please add me on skype @ kshlalala! Thanks!

EDIT: Also, is there a way to change my name? I login-ed from facebook and there wasn't an option to choose my username. Thanks!
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
899
It simply just says that the column 'steamprofile' doesn't exist in the table you selected.
This code is really unsafe and mysql_xxx functions are deprecated.

Use mysqli instead, you can find the manual of it .
 
Rogu3
Joined
May 11, 2012
Messages
933
Reaction score
508
Hi guys, basically. I've just started learning website coding & i bought a source from someone i know. He promised that there won't be any errors and it'll be usable after setting it up. However, sad to say there's a few errors after setting it up. Basically, my website is a CSGO Jackpot website, if it's possible. Please help me on solving these problems, thanks!!

Error 1) mysql_query(): Unknown column 'steamprofile' in 'field list' on line 9
Error 2) mysql_fetch_assoc() expects parameter 1 to be resource, boolean given on line 10.


<?php (LINE 1)
$sitename ="www.xxx.com";(LINE 2)
$link = mysql_connect("ip","root","password");(LINE 3)
$db_selected = mysql_select_db('database',$link);(LINE 4)
mysql_query
("SET NAMES utf8");(LINE 5)

function fetchinfo($rowname,$tablename,$finder,$findervalue){(LINE 7)
if($finder =="1")$result = mysql_query("SELECT $rowname FROM $tablename");(LINE 8)
else$result = mysql_query("SELECT $rowname FROM $tablename WHERE `$finder`='$findervalue'");(LINE 9)
$row= mysql_fetch_assoc($result);(LINE 10)
return$row[$rowname];(LINE 11)
}
?>


If this isn't enough to solve the problem, please add me on skype @ kshlalala! Thanks!

EDIT: Also, is there a way to change my name? I login-ed from facebook and there wasn't an option to choose my username. Thanks!
First and foremost, never believe anyone who says that they're going to sell you a source that has no errors. Especially, in a server-side scripting language such as PHP. The reason being is, just because it works on one server does not mean it will work on yours. So, as far as that guy knows, it works on his server which has a particular configuration, a particular PHP version, and a particular MySQL server set up. Even if all that is exactly the same, errors can and probably will still occur.

Also, like ^ @new name ^ said mysql_ functions are super deprecated which means they are no longer recommended or supported by future versions of PHP. The fact that the guy who sold you this source, sold you it, shows he is also a crappy developer or at least too lazy to update his source. Therefore, I also strongly advise you to look into mysqli_ functionality which I feel are explained decently (at least from a basic learning standpoint) on . I also advise you to ask for a sample code from the source prior to purchase so you can at least get an opinion on it here or maybe at . Finally, if you're still learning, this website helped me a lot in my early stages of web development especially with clean PHP code, it's called .

Finally, to discuss your code, it is extremely messy, and that's not because of the forum's formatting. I recommend adding {} to contain your if else statements. This is strictly for read-ability but that allows you to troubleshoot much easier and find a specific part of the code without confusing it.

For example,
if ($finder =="1") {
$result = mysql_query("SELECT $rowname FROM $tablename");
} else {
$result = mysql_query("SELECT $rowname FROM $tablename WHERE `$finder`='$findervalue'");
}

OT: There is no way to change your name without purchasing a subscription, here.
 
Last edited:
Back
Top