473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Select records from mysql Table

2
I am tearing what is left of my hair out by their roots. What I can get to work in MySQL Command line the exact same thing I cannot get to work in a PHP/MySQL script.

Here is the command line MySQL query
SELECT accesscode FROM authorize_users WHERE (user_id = 'MagooW' AND user_password = 'qwerty' and account = '46815185'; (it works accesscode 86190185 is reurned).

Here is the PHP/MySQL script command (using the same info )
Expand|Select|Wrap|Line Numbers
  1. $query = "SELECT access_code INTO $access FROM authorised_users
  2. WHERE (user_id =  $userid AND user_password = $password AND
  3. account = $account)";
  4. $result = $db->query($query);
  5. $db->close();
  6. echo ('$access after SELECT = '  . $access . "<BR><BR>"); ?>
  7.  
  8. $access = 0.
  9.  
Sep 26 '07 #1
2 1899
ak1dnar
1,584 Expert 1GB
Thread moved to the Php Forum from the Cafe.
With a new thread title instead of "Can anybody help??"

Please, post the technical questions, in the relevant forums.

Back to the question
well, where is the class and its methods?
Sep 26 '07 #2
momogi
28
I am tearing what is left of my hair out by their roots. What I can get to work in MySQL Command line the exact same thing I cannot get to work in a PHP/MySQL script.

Here is the command line MySQL query
SELECT accesscode FROM authorize_users WHERE (user_id = 'MagooW' AND user_password = 'qwerty' and account = '46815185'; (it works accesscode 86190185 is reurned).

Here is the PHP/MySQL script command (using the same info )
Expand|Select|Wrap|Line Numbers
  1. $query = "SELECT access_code INTO $access FROM authorised_users
  2. WHERE (user_id =  $userid AND user_password = $password AND
  3. account = $account)";
  4. $result = $db->query($query);
  5. $db->close();
  6. echo ('$access after SELECT = '  . $access . "<BR><BR>"); ?>
  7.  
  8. $access = 0.
  9.  
may be should be like this:
Expand|Select|Wrap|Line Numbers
  1. $queri="SELECT accesscode FROM authorize_users WHERE user_id = '$_POST(thenameofyourtextfield/radiobutton/etc whichcatch the value of user id)' AND user_password = '$_POST(thenameofyourtextfield/radiobutton/etc which catch the value of user's password)' and account = $_POST(thenameofyourtextfield/radiobutton/etc which catch the value of user's account)' ";
  2. $result=mysql_query($queri);
  3.  
  4.  
  5.  
we assumed that you use the POST method here..
hope that was clear
Sep 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bob Bedford | last post by:
I've a site where companies add their article. I'de like to provide a "lasts articles" table. By this, I'll show last articles inserted. But I won't always the same articles at any refresh....
21
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All...
0
by: Tanamon | last post by:
Hello All, I am a MySQL newbie trying to write a query that selects file_name records possessing the highest numbered version for that unique file_name. I show sample data and two trial queries...
0
by: Debusal | last post by:
I have table one and table two I want to show all records from table one but also check if in table two is record that are in table one so if this is ture then bla=1 if false then bla=2 is it...
0
by: JB | last post by:
Hey ppl, I'm experiancing a very weird problem with my current Win32(win2k/XP) application. I'm using: * Delphi 7 * ADO * mySQL ODBC 3.51 drivers
4
by: Denis St-Michel | last post by:
Hello All, Hope some Guru will be able to help me with this. Let's take this example table A ------------------------------------------------------------------------------- id | ...
2
by: ghasem | last post by:
Dear mySQL community, I have once again turned to the user groups for a problem I cannot solve myself! Atually, I have read all I can from the newsgroups on this but I could not solve it myself....
1
by: anmar | last post by:
I'm trying to figure out how to select all the records in one table which have multiple specified records in a second table. Here's a simplified version of my problem. I have two tables,...
11
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is...
5
by: RioRanchoMan | last post by:
I have a forum table where the field Forum_ID of the first thread corresponds to itself in the field Forum_Ancestor, and 0 (zero) for the field Forum_Parent when it is the first topic in a thread:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.