Help!


Ok in my relentless search to create the perfect member login script for my site. I have started off with a base skeleton and coded it from there. Here is my issue:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

And when I open the .sql file to check line 1 its this piece of code:

PHP Code: CREATETABLEusers(
So I noticed that USERS is a common word so I changed that to users2 instead. REUP The sql file and is still getting the same error, i am jsut stumped, btw its my first time working with php and mysql. Please help, the version of sql i am running is: MySQL 4.0.20
Posted On: Tuesday 20th of November 2012 02:55:32 AM Total Views:  40
View Complete with Replies

RELATED TOPICS OF Microsoft SQL Server PROGRAMMING LANGUAGE




sql INSERT help: how to INSERT from a variable?

i have a .html file shown below. I just want to get the value from the variable and insert that to by access database. Can you please tell me how to get the value in the variable 'nam' in dbcheck() method. i feel the problems are in the red lines highlighted below in my code. the html code: test jscript
VIEWS ON THIS POST

141

Posted on:

Tuesday 20th November 2012
View Replies!

calculating difference - help, please?

hello, i am having problems with sql. suppose that i have two tables. tblOrders and tblServed. in order to find the exact match, both of their OrderID and ItemNo should match with the other table. To know how many items are not yet served, their difference should be calculated (tblOrders.Qty - tblServed.Qty) in the query. i always get a NULL value even though both fields have the same data types and no zero values are found in their databases. SELECT DISTINCT TOP 100 PERCENT tblOrders., (SELECT tblOrders.Qty - tblServed.Qty FROM tblOrders, tblServed WHERE tblOrders.OrderID = tblServed.OrderID AND tblOrders.ItemNo = tblServed.ItemNo) AS UnservedQty FROM tblServed RIGHT OUTER JOIN tblOrders ON tblOrders.OrderID = tblServed.OrderID AND tblOrders.ItemNo = tblServed.ItemNo if there were any related solutions, problems like this posted before, please let me know.
VIEWS ON THIS POST

102

Posted on:

Tuesday 20th November 2012
View Replies!

sql INSERT help: how to INSERT from a variable?

i have a .html file shown below. I just want to get the value from the variable and insert that to by access database. Can you please tell me how to get the value in the variable 'nam' in dbcheck() method. i feel the problems are in the red lines highlighted below in my code. the html code: test jscript
VIEWS ON THIS POST

94

Posted on:

Tuesday 20th November 2012
View Replies!

help with variable problem in IF statement?

hi, i'm completely stumped with this one. It is a simple test (via IF) for booking where it decides which path to follow. Or not so simple, even.. It keeps taking me to same bit. Have tried putting form value into variable. Tried rearranging various ways. The available is definatley being calculated properly and have it displayed. What can be going wrong with form (just added 'id' there too) Is there something missing or do i have to convert to integer format or something The two "booked" and "places" fields are long integers, no indexing, not autoincrements or anything. Have tried for ages with this and is holding me back from the rest of code and final few pages of my site...which is VERY frustrating.
VIEWS ON THIS POST

139

Posted on:

Tuesday 20th November 2012
View Replies!

Write an email reminder/email scheduling procedure help?

I need to be able to send a reminder to my users who have not submitted data by a certain date,on the other hand need to be able to send data once gathered to a person analaysing it. I have strongly been advised to write a procedure for an SQL server that would do that for me,except that I have never written a single procedure. And how would I once I hopefully write this procedure "link" it, make it work with my asp web pages\t I was hoping to see if somebody could help me with this,show me an example of a procedure they have created or something similar,any help is welcome.
VIEWS ON THIS POST

222

Posted on:

Tuesday 20th November 2012
View Replies!

Dateparts help

I have a query that is leaving off records that take place after 12:00 on the last day of the week. Is there a way to use DatePart to do this Or some other way This is my query Code: "SELECT CASE WHEN [PRIORITY] = 1 THEN 'P1' WHEN [PRIORITY] = 2 THEN 'P2' WHEN [PRIORITY] = 3 THEN 'P3' END AS [PRIORITY], COUNT(*) AS PriorityCount FROM SNA_Ticket_Detail WHERE (Reviewed = '1') AND ([DtRFC] BETWEEN (@DtRFC - 6) AND (@DtRFC)) GROUP BY [PRIORITY]">
VIEWS ON THIS POST

98

Posted on:

Tuesday 20th November 2012
View Replies!

Database Design help!!!

I am currently working on the conceptual design for a database but im having some trouble with the specs, the database is for a company that runs courses, as part of thier spec for the database they state that the fees fo the courses vary depending on the number of delegates a company sends. I was wondering how i would create this in the databse so the fees would vary. They say if one person joins the fee would be 1200, however if two join the first would pay 1000 and the second 800, the course can be attended by a number of delegates, subject to a limit for each course. I would really appreciate any help on this im im unsure on how to implement this structure within a database as im fairly new to datbase design.
VIEWS ON THIS POST

98

Posted on:

Tuesday 20th November 2012
View Replies!

Performance and database improve help

Hi , from your experience in SQL 2005 - do i have any free software that can help in improve performance or can help in identifying performance bottleneck. two examples of performance and help that i use usually use are the maintenance plan that do (check DB > reorganized index > rebuild index > update statics) and the second software is the SQL 2005 DASHBOARD for the reporting help. do you have any other free tools and help that you can give me for performance or any thing that i must have in my SQL 2005 servers. Thx
VIEWS ON THIS POST

89

Posted on:

Tuesday 20th November 2012
View Replies!

Noob looking for help

hello all, i have a view created in SQL, i want to take the results from that view and insert it into a table. i want this to happen every night. Each night overwriting the data that was previously there. how would i do this
VIEWS ON THIS POST

133

Posted on:

Tuesday 20th November 2012
View Replies!

database structure help

ok need a bit of help with creating a database for the structre of my company, the attached image is an example of the hierachy in my company (ignore the names) I'm ok with the staff table but my main problem is with the department table. This is how I had it at first DeptID (primary key) DeptName DeptHead (staff members id - foreign key) Level Parent In the image you should see the level number beneath the dept name, fairly obvious what I thought here. And again Parent refers to the parent field directly above, for instance in this case the parent of the Hats Department would be Candles, parent of Candles would be Bakery, parent of Bakery would be board..... now onto the problem.... With this example if I wanted to list in the hats department I could use an SQL statement roughly like this SELECT * FROM Staff,Department WHERE (Department.Dept=hats or Department.Parent=hats) AND (Staff.DeptID=Department.DeptID) now what this would return would be in the hats and fishmonger department....however I also need to list in Candles, Bakery and Board....don't think this is possible with my structure kinda stuck, anyone faced this problem before
VIEWS ON THIS POST

123

Posted on:

Tuesday 20th November 2012
View Replies!

Please help with Update query

Hi ! Please help... How I can write a query in which I update some text in column. I have a column with long text(not only one word),in this text I only want to update x to y ,for example.
VIEWS ON THIS POST

172

Posted on:

Tuesday 20th November 2012
View Replies!

table design help needed

I have a gamming website. I have pages which displays data from other clans. Members need to register and login to view full clan details. User who have not logged in can only view partial data. Now I need to keep track of the kind of hits each page received. That is I want to tell clan say X that these particular members viewed your page these many times and on these dates and these members who have not registered have viewed your page these many times and on these dates. I am using ASP with MS SQL. I would like some help on designing the tables and layout that is efficient.
VIEWS ON THIS POST

111

Posted on:

Tuesday 20th November 2012
View Replies!

help....can't even install SQL server in XP!

Hi all, i need help for the installation.. SQL server 2000 gave me the error "The logon account cannot be validated for the SQL service . Verify that the user name and password entered are correct. The logon attempt failed." I used my windows XP administrator account username and password .. why it won't allowed me to install using a Domain user account instead of the local system account\t The funny thing is that i did installed SQL server before but the SQL server service cannot be logon when i tried to use it..so i reformatted my HD. Please help.....i do not wish to reformat my HD again or use the local system account during the installation. Local System account vs Domain User account.. which is better\t
VIEWS ON THIS POST

215

Posted on:

Tuesday 20th November 2012
View Replies!

Query Problem.. Logic Problem need help

Im trying to get the stored procedure to send back the rows which are only 'proposal's but i keep getting the other type (jobs) in this case in the C# Web App as well Can anyone see a problem with my code... thanks CREATE PROCEDURE SP_GetProposalListGenerator( @strPropID varchar(35), @strPDPM varchar(10), @strBusinessGroup varchar(40), @strLocation varchar(20), @strStudyType varchar(20), @strStatus varchar(6), @strProposalName varchar(35), -- @dtmProposalDateMin datetime, --not used -- @dtmProposalDateMax datetime, @strCompanyCity varchar(30), @strContact varchar(40), @strCompany varchar(40) ) AS --Declare string variables to be used to execute the command DECLARE @strCMDAND varChar(8000) DECLARE @strCMDOR varChar(8000) SET @strCMDOR = '' SET @strCMDAND = '' BEGIN SET @strCMDAND = @strCMDAND+'SELECT a.TITLE, a.CONTSUPREF, a.ZIP, a.COUNTRY, a.ADDRESS1, a.STATE, a.ADDRESS2, a.LINKACCT, a.NOTES, a.ACCOUNTNO, a.EXT, b.COMPANY, b.CONTACT, b.CITY, b.PHONE1, b.PHONE2, b.PHONE3, b.STATE as c1STATE, b.COUNTRY as c1COUNTRY FROM CONTSUPP a INNER JOIN CONTACT1 b on a.ACCOUNTNO = b.ACCOUNTNO WHERE ( ' END --Only add where condition if the search parameter is actually being searched for. FOR # 1 -> 10 /* IF (@strSOMETHING IS NOT NULL) BEGIN (scope { ) -if the parameter is used then SET @strCMDAND = @strCMDOR +'(x.SOMETHING LIKE ''%'' + @strSomething + ''%'') AND ' -add condition that the field will either be like the search parameter SET @strCMDOR = @strCMDOR + '(x.SOMETHING = NULL) AND ' -or the field will be completely null END ( } scope ) */ IF (@strPropID IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND +'(a.TITLE LIKE ''%'+ @strPropID +'%'') AND ' SET @strCMDOR = @strCMDOR + '((a.TITLE IS NULL) OR (a.TITLE = '''')) AND ' END IF (@strPDPM IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(a.ZIP LIKE ''%' +@strPDPM +'%'') AND ' SET @strCMDOR = @strCMDOR + '((a.ZIP IS NULL) OR (a.ZIP = '''')) AND ' END IF (@strBusinessGroup IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(a.ADDRESS1 LIKE ''%' +@strBusinessGroup +'%'') AND ' SET @strCMDOR = @strCMDOR + '((a.ADDRESS1 IS NULL) OR (a.ADDRESS1 = '''')) AND ' END IF (@strLocation IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '((a.COUNTRY LIKE ''%'+ @strLocation +'%'') OR (b.STATE LIKE ''%'+ @strLocation +'%'')) AND ' SET @strCMDOR = @strCMDOR + '((a.COUNTRY IS NULL) OR (a.COUNTRY ='''')) OR ((b.STATE IS NULL) OR (b.STATE = '''')) AND ' END IF (@strStudyType IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(a.ADDRESS2 LIKE ''%'+ @strStudyType +'%'') AND ' SET @strCMDOR = @strCMDOR + '((a.ADDRESS2 IS NULL) OR (a.ADDRESS2 = '''')) AND ' END IF (@strCompanyCity IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(b.CITY LIKE ''%'+ @strCompanyCity +'%'') AND ' SET @strCMDOR = @strCMDOR + '((b.CITY IS NULL) OR (b.CITY = '''')) AND ' END IF (@strStatus IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(a.EXT LIKE ''%'+ @strStatus +'%'') AND ' SET @strCMDOR = @strCMDOR + '((a.EXT IS NULL) OR (a.EXT = '''')) AND ' END IF (@strProposalName IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(a.CONTSUPREF LIKE ''%'+ @strProposalName +'%'') AND ' SET @strCMDOR = @strCMDOR + '((a.CONTSUPREF IS NULL) OR (a.CONTSUPREF = '''')) AND ' END --Not used in Jobs --IF ((@dtmProposalDateMin IS NOT NULL) OR (@dtmProposalDateMax IS NOT NULL)) BEGIN -- SET @strCMDAND = @strCMDAND + '(CONVERT(int,a.LASTDATE) >'+CONVERT(int,@dtmProposalDateMin)+') AND (CONVERT(int,a.LASTDATE) < '+CONVERT(int,@dtmProposalDateMax)+') AND ' -- SET @strCMDOR = @strCMDOR + '(a.LASTDATE IS NULL) AND ' --END IF (@strContact IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(b.CONTACT LIKE ''%'+ @strContact +'%'') AND ' SET @strCMDOR = @strCMDOR + '((b.CONTACT IS NULL) OR (b.CONTACT ='''')) AND ' END IF (@strCompanyCity IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND + '(b.CITY LIKE ''%'+ @strCompanyCity +'%'') AND ' SET @strCMDOR = @strCMDOR + '((b.CITY IS NULL) OR (b.CITY ='''')) AND ' END IF (@strCompany IS NOT NULL) BEGIN SET @strCMDAND = @strCMDAND+ '(b.COMPANY LIKE ''%'+ @strCompany +'%'') AND ' SET @strCMDOR = @strCMDOR + '((b.COMPANY IS NULL) OR (b.COMPANY = '''')) AND ' END --Put the entire string together so that it can be executed. 1=1 is for the extra AND that will be at the end of the next condition --since we dont know when it will stop adding conditions SET @strCMDAND = @strCMDAND + '1=1) OR ('+@strCMDOR+'1=1) AND (a.RECTYPE = ''P'') AND (a.CONTACT = ''PROPOSAL'')' --the type will always be a job EXEC(@strCMDAND) GO
VIEWS ON THIS POST

100

Posted on:

Tuesday 20th November 2012
View Replies!

help extracting user info

please can anyone help me i have a ipb forum some how i accidently delete my post i have a old backup from 3 week ago how can i extract the post from the backup NOTE: the only post that was deleted was post made by me none of the other member post was deleted i did not want to restore the entire post table beacause i would loose post in the past 3 weeks can anyone help me with a script or anything i can used to extract post of the post table where the poster id is 1 here is a sample INSERT INTO `ibf_posts` VALUES (2, 0, NULL, 1, 'albertldee', 1, 1, '12.8.34.199' INSERT INTO `ibf_posts` VALUES (3, 0, NULL, 4, '\t\t-\t', 1, 1, '207.44.154.35 INSERT INTO `ibf_posts` VALUES (4, 0, NULL, 6, 'demarcus', 1, 1, '69.142.131.149 INSERT INTO `ibf_posts` VALUES (5, 0, NULL, 7, 'gottasteu', 1, 1, '65.12.169.41 the post table has about 122000 line like above i just want to extract all the line that has albertldee like line number 1
VIEWS ON THIS POST

179

Posted on:

Tuesday 20th November 2012
View Replies!

Create Parameters DataType help

Hi I am creating a Parameter for my Command Object. In my database, the field is of type ntext with a length of 16. When I use the .CreateParameter method (I am using the shortcut text here..), what is the DataTypeEnum for it Is it adVarChar 16 or what .Parameters.Append .CreateParameter("@strComments", adVarChar, adParamInput, 16) sanctos
VIEWS ON THIS POST

103

Posted on:

Tuesday 20th November 2012
View Replies!

select statement help

I have a select query statement that is not producing the results i want. I am joining a table (B) to another table (A). Table A will always have one record, but table B may have 0 or more records. If table B has at least one record, one of them will be flaged in a column (bDefault = 1) and the rest (bDefault = 0). What i need to do is select from table A and if there are records in table B get the one with bDefault=1. This has proven to be beyond my skills. Below is the code I have tried so far. What happens when i run it is this: table B has three records for one member (6) and just one for another (3). the querry returns three rows for 6 and one for 3. How ever many records there are in table B for a given member is how many rows are returned by the query. I don't want that. i want to return only one row per member and if they have a row in table b, return only the row from table B where bDefault = 1 and if they don't have a row in table B, to ignore it. Here is the first code I am tried: SELECT P.nMID, P.nAge, (SELECT MI.sURLPath + 't_' + convert(varchar(10),MI.nID) + '.jpg' WHERE bDefault = 1 AND MI.nMID = P.nMID) as sURLPath FROM tblMember_profile P Left Outer JOIN tblMember_Images MI ON MI.nMID = p.nMID WHERE P.nMID IN ('7','6') ORDER BY P.nMID the 2nd querry here produced the same result: SELECT P.nMID, P.nAge, (SELECT MI.sURLPath + 't_' + convert(varchar(10),MI.nID) + '.jpg' WHERE bDefault = 1 AND MI.nMID = P.nMID) as sURLPath FROM tblMember_profile P JOIN tblMember_Images MI ON MI.nMID = p.nMID WHERE P.nMID IN ('7','6') ORDER BY P.nMID and this is the result: 6 22 NULL 6 22 /images/MemImages/t_36.jpg 6 22 NULL 7 27 /images/MemImages/t_51.jpg I tried this too: SELECT P.nMID, P.nAge, (MI.sURLPath + 't_' + convert(varchar(10),MI.nID) + '.jpg') as sURLPath FROM tblMember_profile P JOIN tblMember_Images MI ON MI.nMID = P.nMID WHERE MI.bDefault = 1 AND P.nMID IN ('6','7') ORDER BY P.nMID and it gave me the results i wanted except that if someone does not have a record in table 2, it does not display them at all. it looks like this: 6 22 /images/MemImages/t_36.jpg 7 27 /images/MemImages/t_51.jpg I know this is long and drawn out, but could someone please make a suggestion on how to deal with this
VIEWS ON THIS POST

100

Posted on:

Wednesday 21st November 2012
View Replies!

Urgent! Please help. Can't insert!

I am running SQL2000 on W2k server. Everything was working fine untill sometime yesterday. in a sudden, I was not able to insert into my database table. I can do select, and I can even run sp_columns on the table, but when I try to INSERT, I get the following error ... Server: Msg 208, Level 16, State 3, Line 4 Invalid object name [tablename]. The insert statment should be working fine as they were run before the problem occurs! Has anyone ran into this before Any input is appreciated!
VIEWS ON THIS POST

159

Posted on:

Wednesday 21st November 2012
View Replies!

Need help to export data to EXcel

iam developed a module. but i want to take data backup every week related to that module. for that i want to generate one button. by clicking that button i want to import tat data in to EXCEL file. any one can help me and save me from tis problem.
VIEWS ON THIS POST

330

Posted on:

Monday 26th November 2012
View Replies!

Hi members help

Code: DECLARE @val VARCHAR(12) declare @p tinyint declare @s tinyint SET @val = '918.56JOA' set @p=len(@val)-1 set @s=len(@val) - charindex('.',@val)-3 select @p as p,@s as s select len(@val)-1 precisions select len(@val) - charindex('.',@val)-3 scale SELECT CONVERT(DECIMAL(@p,@s), LEFT(@val,6)) s iam trying to use this code to automatically get the precision and scale from the value but i get the following error please hep Error name Server: Msg 170, Level 15, State 1, Line 15 Line 15: Incorrect syntax near '@p'.
VIEWS ON THIS POST

189

Posted on:

Monday 26th November 2012
View Replies!