Page 1 of 1 1
Topic Options
#75506 - 2003-06-20 11:49 AM Urgent help required with DBGetRecordSet
kncowans Offline
Getting the hang of it

Registered: 2000-11-11
Posts: 98
Loc: Doncaster, UK
Hello all

When I try to use the code listed below I get an 'Expected Expression' error on the DBGetRecordSet line.

Any help is appreciated.

Thanks in advance

Kevin

$dsn = "DRIVER=MySQL;SERVER=School;UID=root;PWD=;DATABASE=Internet"

$connection=DBConnOpen($dsn)

$YOI = SubStr( @UserID ,2 , 2)

$UserID = SubStr( @UserID , 4 , 4)

$recordset = DBGetRecordset($connection,"SELECT Internet FROM Access WHERE YOI='$YOI' AND USERID='$USERID'")

$retcode = DBConnClose($dsn)
_________________________
Kevin Cowans Senior ICT Technician The Armthorpe School

Top
#75507 - 2003-06-20 05:42 PM Re: Urgent help required with DBGetRecordSet
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Check the returned error codes, as it is possible that the DBConnOpen did not suceed. Is a MySQL ODBC driver installed?

Also, rather use
code:
"SELECT Internet FROM Access WHERE YOI='"+$YOI+"' AND USERID='"+$USERID+"'"

as it is recommended to not have vars in strings.

Or try a simple SQL statement like "SELECT * FROM Access".

[ 22. June 2003, 22:36: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#75508 - 2003-06-21 04:51 PM Re: Urgent help required with DBGetRecordSet
kncowans Offline
Getting the hang of it

Registered: 2000-11-11
Posts: 98
Loc: Doncaster, UK
Hello Sealeopard

Thanks for the reply.

I think your solution to do with the variables may fix the problem as when I replace the variables with fixed data the code works correctly.

Bye for now

Kevin
_________________________
Kevin Cowans Senior ICT Technician The Armthorpe School

Top
#75509 - 2003-06-22 10:37 PM Re: Urgent help required with DBGetRecordSet
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
SQL Statemenst are rather finicky with regards to the use of quotes. I always put a SQL statement into a variable before feeding it into the UDF.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.053 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org