Jump to content

Get data from MYSQL


shirvo

Recommended Posts

I have a database called family and in that i have a table that is called users, within that table there is ID, username, password,fname,lname,email. Now for example i want to get the data password from the username name shirvo.

$name_check = $db_object->query("SELECT password FROM users WHERE username = 'shirvo'");
echo $name_check;

Now i thought this would do it but all it returns is "object" not the password that should be something like this
"54f3e4882509eb50e344e3fc41e11924" but it doesn't so what can i do.
Link to comment
https://forums.phpfreaks.com/topic/27314-get-data-from-mysql/
Share on other sites

Well! You are trying with q wrong query!

[code]
<?php
$name_check = $db_object->query("SELECT password FROM users WHERE username = 'shirvo'");
?>
[/code]

It should be like this

[code]
<?php

$name_check = mysql_query("SELECT password FROM users WHERE username = 'shirvo' ") or die (mysql_error());
#Now name_check will contain the result set
$res=mysql_fetch_array($name_check);
echo $res['password'];
?>
[/code]

Cheers :)
Link to comment
https://forums.phpfreaks.com/topic/27314-get-data-from-mysql/#findComment-124892
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.