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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

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.