Jump to content
  • 0

Help! Create MYSQL Sintax


Overlord

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  10/05/13
  • Last Seen:  

Hello!

I have FluxCP on my server, and, need help to edit "donation page":

 

"Credit Balance"

Replace it for "Cash Points". 

 

I Found in my mysql database this table:

"acc_reg_num_db".

 

Need a MYSQL sintax, to SHOW "value" in "acc_reg_num_db".

 

Cash Points: "value"

understand?

 

 

help with this code:

<?php 
	// definições de host, database, usuário e senha 
	$host = "localhost"; 
	$db = "ragnarok"; 
	$user = "xxxxxxxx"; 
	$pass = "xxxxxxxx"; 
	
	$con = mysql_pconnect($host, $user, $pass) or trigger_error(mysql_error(),E_USER_ERROR); 

	mysql_select_db($db, $con);

	$query = sprintf("SELECT accont_id, key, value FROM acc_reg_num_db"); 

	$dados = mysql_query($query, $con) or die(mysql_error()); 

	$value = mysql_fetch_assoc($dados); 

	$total = mysql_num_rows($dados); ?>

	<?php 

I make this code, but, show this error in my page:

Cash points: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, value FROM acc_reg_num_db' at line 1

Tanks to support, sorry for my english.

 

 

 

Português Brasil

Galera, to com um problema em um código MYSQL que fiz.

O código seria para mostrar a quantidade de cash que existe em determinada conta.

achei a tabela "acc_reg_num_db" que diz a quantidade de cash que tem em cada conta.

 

Mais o código que eu fiz não ta funcionando, como faço pra poder mostrar a quantidade no meu site?

Sendo que tenho que primeiro selecionar o "account_id" do usuário e mostrar sómente o value em que o KEY for "#cashpoints".

Na tabela acc_red_num_db está assim:

ACCOUNT_ID            KEY              index        VALUE

2000001               #TimeOn                 0              5000
2000001               #CASHPOINTS        0             5000

 

 

agradeço ai quem puder ajudar!

Edited by calango
Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

I think you have a typo.

 

 

SELECT account_id,key,value FROM acc_reg_num_db
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  10/05/13
  • Last Seen:  

Yes sandbox, thank for u help, but...

Need a especific code to show the VALUE in KEY '@CASHPOINTS' in MY ACCOUNT page.

 

It is first necessary that the code only show the VALUE of the logged ACCOUNT_ID in the website.

 

ex result:

CASH POINTS: 9999

Edited by calango
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  79
  • Reputation:   6
  • Joined:  12/10/13
  • Last Seen:  

didn't really understand what you are trying but if you want to show the value of the cashpoints row you have to make a query like this:

SELECT value FROM acc_reg_num_db WHERE KEY = '#CASHPOINTS' AND account_id = xxx

so you are selecting the value in the row that the key has stored #CASHPOINTS and the account_id is the number of the account id you want to search, ( i guess you need it i dont know how you got coded everything) maybe all of this isn't what you are looking for /heh

Edited by Doch
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  10/05/13
  • Last Seen:  

Thank doch and sandbox!

 

through a SQL code I want to put on my web page the amount of cash that the player on the site has logged understand? 

 

your code: 

SELECT value FROM acc_reg_num_db WHERE KEY = '# CashPoints' AND account_id = xxx 

 

in "account_id" should be the player logged into the site, how do this?

 

sry for my english.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  79
  • Reputation:   6
  • Joined:  12/10/13
  • Last Seen:  

When you log in a website you check if the username and the password matches with some account stored in your database, if it does, you log in, so you have to have something (id, username w/e) that is unique in that account to be able to select just the account you want, so id is the perfect value to do this because two accounts cannot have the same id, and something similar to the username.

 

you have to store somewhere the username or the id, depending how you code your website, to later be able to fill that parameter(account_id, username, [unique_parameter]) to search in the row you want the value. Hope you understand me :)

 

Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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...