notops Posted October 13, 2009 Share Posted October 13, 2009 Hi guys, Im pretty new to PHP and Mysql, and im trying to fix a script. I have been reading alot about mysql_fetch_array etc, but i could still need some help. Especially about one thing. The script i want to make, is one where a user can get out infomation about his "account" without logging in. He simply enters his usernumber and gets the two other rows in the database. But i really cant figure out, how to let the user decide what colums that should be shown. I set the usernumber as primary in the db. If anyone could point me in a direction here, it would be apreciated. As im doing this most to learn, i dont really want a complete howto, or finished script. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/ Share on other sites More sharing options...
Adam Posted October 13, 2009 Share Posted October 13, 2009 But i really cant figure out, how to let the user decide what colums that should be shown You mean each user can save in some fashion, which or both of the 2 rows they'd like to be made visible when someone enters their user ID? Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-936194 Share on other sites More sharing options...
notops Posted October 13, 2009 Author Share Posted October 13, 2009 I will save the info. Im gonna use it to show the users how many "bonus points" they have. So i want a script that tells the user how many points he got when he enters hes id. So the first Row wil be primary usernames, second will be full name, and the last one will be the bonus points, that i will make another script to edit. So if the user enters his username he will be able to see the other two columns after his username. So it will be like user1 name points user2 name points etc. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-936211 Share on other sites More sharing options...
notops Posted October 15, 2009 Author Share Posted October 15, 2009 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937536 Share on other sites More sharing options...
Adam Posted October 15, 2009 Share Posted October 15, 2009 This is just basic SQL? select name, points from table_name where username = 'blah blah' Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937548 Share on other sites More sharing options...
notops Posted October 15, 2009 Author Share Posted October 15, 2009 Well choosing table(s) wont help me much here? Cause i want to choose columns. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937631 Share on other sites More sharing options...
Adam Posted October 15, 2009 Share Posted October 15, 2009 That is selecting fields... select name, points from table_name where username = 'blah blah' Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937632 Share on other sites More sharing options...
mikesta707 Posted October 15, 2009 Share Posted October 15, 2009 .. you aren't choosing tables.. you are choosing columns. I suggest you read up on SQL before you try to do this, because you don't seem to understand the most basic of queries. i found this tutorial very good when i first learned Tizag Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937634 Share on other sites More sharing options...
notops Posted October 15, 2009 Author Share Posted October 15, 2009 Yeah i know im selecting columns, i never said anything else. Im not really into reading and learning all php and mysql from scratch, rather learn while i write. I tried googling 1 hour for any text about doing this, but cant find a single answer. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937636 Share on other sites More sharing options...
Adam Posted October 15, 2009 Share Posted October 15, 2009 Yeah i know im selecting columns, i never said anything else. Well choosing table(s) wont help me much here? Cause i want to choose columns. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937644 Share on other sites More sharing options...
MatthewJ Posted October 15, 2009 Share Posted October 15, 2009 Yeah i know im selecting columns, i never said anything else. Im not really into reading and learning all php and mysql from scratch, rather learn while i write. I tried googling 1 hour for any text about doing this, but cant find a single answer. Why not just pay someone to write it? You're putting the cart before the horse as they say. You will save a lot of time and energy if you just start from scratch and learn the right way. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-937648 Share on other sites More sharing options...
notops Posted October 16, 2009 Author Share Posted October 16, 2009 Well, its not really that important. So i dont feel like paying anyone to do it. I do know a bit php, connecting to mysql dbs etc, but not how write a script where it searches the first row for the user input and then puts out the whole column. But, i guess ill try asking google for some more help. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-938024 Share on other sites More sharing options...
Adam Posted October 16, 2009 Share Posted October 16, 2009 You've not clearly explained what it is you're trying to do at all. Try giving examples of user input, the matching row of data, and what you expect outputted; then you'll probably get some decent help. Quote Link to comment https://forums.phpfreaks.com/topic/177553-help-a-newbie/#findComment-938097 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.