CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Perl

 ODBC SQL select statement problem

Print topic Send  topic

Author Message
Zack Frankowski
Posted: 01/07/2005, 1:19 PM

Hi All!

Quick question -- When I use a select statement ie: select * from apsvehicles where tag = '$tag' - it doesn't pull any results. When I change $tag to 4717 in the statement and hard code it, it works. When I leave out the where portion it works. I've tried using sql(q{$sqlstatement}) and making the sqlstatement = "select * from apsvehicles where tag = '$tag'; and nothing ever seems to work.

Any help would be much appreciative!!

Thanks - Zack
mrachow


Posts: 509
Posted: 01/09/2005, 1:00 AM

The apostrophe (being right sql syntax) is preventing the $tag from being expanded.
Try To build something like
...where tag = '" . $tag . "'...
_________________
Best regards,
Michael
View profile  Send private message
Magnus
Posted: 07/13/2005, 10:16 AM

Dear All;
I have a table in my database named 'registration' Then I have a form where people put in their username, password,email address,gender etc. I have another form called 'login' where user will type his username and password to have access to the website. My problem is that I don't know the correct sql statement I will use to allow already registered user into my website. I tried the code below but it retrieves all username and password from the 'registration' table but I want to check if the username and password corresspond with the login information.
Note: I am using JSP

String sqlQuery = "Select * From registration ";
ResultSet result = sqlStatement.executeQuery(sqlQuery);

while ( result.next() )
{

String user = result.getString("username");
String pass = result.getString("password1");

if( (request.getParameter("userName") == user)&& (request.getParameter("password")== pass) )
{
String redirectURL = "projectlist.jsp";
response.sendRedirect(redirectURL);
}
else
{
out.print("Did You Forgot Your Username And Password\n");

}
}
wkempees
Posted: 07/13/2005, 11:02 AM

I am no JSP man.
The way you propose to do things is probably not the best and safest way
BUT
Your Select statement should be

SELECT * FROM registration WHERE username=user and password=pass

Please translate this to your language requirments.
IF user and pass are correctly filled you will end up with ONE row.
IF not result will be zero rows.

Hope this helps.
But I would recommend using the Login logic supplied by CCS.
That would (at least in PhP) return the Id for the user, after that
things are easy.

greetz,
Walter
Permana
Posted: 08/10/2005, 2:53 AM

I Have a problem:
I have jsp file which is connect to Ms Acces, when i execute quey...there is an error:

C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\Test_jsp.java:67: cannot resolve symbol
symbol : method executeQuery (java.lang.String)
location: class java.lang.String
ResultSet _rs = sqlStatement.executeQuery(sqlQuery);

What shoud I do, so i may access my table in Ms Access ...
thx.

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.