473,469 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

select into statement not working..help pls

hi,

what is wrong with my statement why it is not working:

$sel="select username,password into '$user','$pass'
from mytable where email = '$p' ";
mysql_query($sel) or die ('error: cannot perform query');
echo $user.' '.$pass;

my objective is to assign values to the local variables taking from
the table. what is the proper way to do it?

May 21 '07 #1
3 1520
"shotokan99" <so**********@yahoo.comwrote in message
news:11**********************@36g2000prm.googlegro ups.com...
hi,

what is wrong with my statement
The whole concept.
$sel="select username,password into '$user','$pass'
from mytable where email = '$p' ";
mysql_query($sel) or die ('error: cannot perform query');
echo $user.' '.$pass;

my objective is to assign values to the local variables taking from
the table.
It don't work like that, into has a very different meaning.
what is the proper way to do it?
Here's one way:

$sel="SELECT username, password FROM mytable WHERE email = '$p'";
$result = mysql_query($sel) or die ('error: cannot perform query');
list($user, $data) = mysql_fetch_array(result);
echo $user.' '.$pass;
--
Ra*********@gmail.com

"Good tea. Nice house." -- Worf
May 21 '07 #2
tnx..it did the trick

May 21 '07 #3
On 21 Mai, 09:05, shotokan99 <soft_devj...@yahoo.comwrote:
hi,

what is wrong with my statement why it is not working:

$sel="select username,password into '$user','$pass'
from mytable where email = '$p' ";
mysql_query($sel) or die ('error: cannot perform query');
echo $user.' '.$pass;

my objective is to assign values to the local variables taking from
the table. what is the proper way to do it?
Hi shotokan99,

you cant't assign result os an statement to local variables using
something like select ... into ...

You need to pass the result to mysql_fetch_array() or
mysql_fetch_row() to get the result of the executed query. Following
snippd shows the basic usage (without any errorhandling):
[snip]
$sel="select username, password from mytable where email = '$p' ";
$res = mysql_query($sel) or die ('error: cannot perform query');
$row = mysql_fetch_row($res);
echo $row[0].' '.$row[1];
[/snap]

purcaholic

May 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alex Glaros | last post by:
I need help on my basic table connection syntaxt using PHP. I call the php from a web browser url_name_goes_here/test.php. The database name is tennis and the user name is tennis. If I type...
16
by: Andie | last post by:
Hello All, I have this sql statement thats works in MSSQL when I call a function function showNewProd(dispNum) 'Declare some variables dim mySQL, rsTemp, tempStr, count 'Read Database
3
by: dumbledad | last post by:
Hi All, I'm confused by how to replace a SELECT statement in a SQL statement with a specific value. The table I'm working on is a list of words (a column called "word") with an index int...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Eddie | last post by:
I have a DataTable.Select() statement with a DateTime field that is being compared to a Date: Dim drCal as DataRow() = tblCal.Select("CalendarItemDate ='12/1/2003'", "CalendarItemDate",...
3
by: mark.irwin | last post by:
Hello all, Have an issue where a redirect pushes data to a page with a select case which then redirects to another page. Problem is the redirect isnt working in 1 case. Code below: strURL =...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
2
by: kxyz | last post by:
Hello everyone, I need help with a stored procedure or two. My stored procedures are supposed to check if a certain record exists. If it does exist, then I select everything from that row, as...
45
by: dizzydangler | last post by:
Hi, I'm new to access (2007, running on XP), but I've gotten some great help from this site on my project so far. However, the more I know, the more complex the problems seem to become.... I'm...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.