c70236 Posted March 19, 2013 Share Posted March 19, 2013 I have come accross a script for login credentials, however I am new to MySQL SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword' I added a third detail to the database, a class for each user under the column I named 'class' how can I retrieve this detail from the database? I don't know how to retrieve this... It looks like the answer I seek has been put into a variable called $result $result=mysql_query($sql); Quote Link to comment https://forums.phpfreaks.com/topic/275877-printing-a-single-value-from-mysql-database/ Share on other sites More sharing options...
Jessica Posted March 19, 2013 Share Posted March 19, 2013 That's just the result object, you need to then fetch a row. Which your script is probably already doing. Find the next time $result is used. Quote Link to comment https://forums.phpfreaks.com/topic/275877-printing-a-single-value-from-mysql-database/#findComment-1419628 Share on other sites More sharing options...
c70236 Posted March 19, 2013 Author Share Posted March 19, 2013 its only used here: $count=mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/275877-printing-a-single-value-from-mysql-database/#findComment-1419631 Share on other sites More sharing options...
Jessica Posted March 19, 2013 Share Posted March 19, 2013 mysql_fetch_assoc That script you found probably isn't very good, there's not much point in selecting a row you do nothing with other than the count, you would just do a COUNT() in the query then. Quote Link to comment https://forums.phpfreaks.com/topic/275877-printing-a-single-value-from-mysql-database/#findComment-1419659 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.