php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16949 mysql_query SELECT returns Resource ID
Submitted: 2002-05-01 16:22 UTC Modified: 2002-05-02 16:55 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Vipervirus at Angelfire dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.1.2 OS: ?
Private report: No CVE-ID: None
 [2002-05-01 16:22 UTC] Vipervirus at Angelfire dot com
I've been trying for a week now to fix this, finally gave up on it:

$sql = mysql_query("SELECT pass FROM users WHERE name = '$user'");
echo $sql[pass] . "<br>";

when ran, $sql = Resource ID #2 instead of the actual value, I couldn't get any help from #php on irc.gamesnet.net	

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-01 16:23 UTC] Vipervirus at Angelfire dot com
I've been trying for a week now to fix this, finally gave up on it:

$sql = mysql_query("SELECT pass FROM users WHERE name = '$user'");
echo $sql . "<br>";

when ran, $sql = Resource ID #2 instead of the actual value, I couldn't
get any help from #php on irc.gamesnet.net
 [2002-05-01 16:23 UTC] derick@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
 [2002-05-01 16:37 UTC] daniel@php.net
I give some help anyway. 

Vipervirus, mysql_query returns the connection id. You must use mysql_fetch_array() to get the values. Please have a look at the example provided in the manual:

  http://www.php.net/manual/en/ref.mysql.php

or

  http://www.php.net/manual/en/function.mysql-fetch-array.php

which has some shorter examples. good luck.

Next time please consult the "PHP General" mailinglist:

  http://www.php.net/support.php

 [2002-05-01 18:48 UTC] Vipervirus at Angelfire dot com
I didn't post here intending to ask for help, I was posting a bug because 

$sql = mysql_query("SELECT * FROM users"); works just fine

but $sql = mysql_eury("SELECT * FROM users WHERE name = '$user'"); doesn't work

I've tried this on completely diff servers and got the same result
 [2002-05-02 16:55 UTC] daniel@php.net
maybe because it's spelled mysql_QUERY and not mysql_EURY.

I asked you kindly no to use the bug reporting form for support questions and instead move to the mailing lists. Here's the link again:

  http://www.php.net/support.php

-daniel
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 16:01:28 2024 UTC