[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2007-10-25T20:21:45-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/2456 2007-10-25T20:21:45-05:00 2007-10-25T20:21:45-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15500#p15500 <![CDATA[Help with searching for words (for a data base)]]>
My guess is that you read the last record and then issued another read command.

That's the best I can do, given that you didn't post your program.

Note that my program has a test for EOF.

Mac

Statistics: Posted by Mac — Thu Oct 25, 2007 8:21 pm


]]>
2007-10-25T06:17:22-05:00 2007-10-25T06:17:22-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15497#p15497 <![CDATA[Help with searching for words (for a data base)]]> Statistics: Posted by Sinuvoid — Thu Oct 25, 2007 6:17 am


]]>
2007-09-25T21:13:44-05:00 2007-09-25T21:13:44-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15339#p15339 <![CDATA[Help with searching for words (for a data base)]]>
ok fixed up code to what you guys told me, also tried moneo's LINE INPUT but still askes me for a #..what should i do?
I'm sorry that I mentioned the LINE INPUT before. Like I had said, that will only work if you set up the fields in the record in a fixed format. You don't have the record set up this way, so forget it.

I tested Mac's version and it works perfectly, as expected. Mac never posts code that doesn't work. I don't understand why it didn't work for you. Download it again. I suggest you work on Mac's version and abandon your original version.

Regards..... Moneo

Statistics: Posted by moneo — Tue Sep 25, 2007 9:13 pm


]]>
2007-09-25T20:00:24-05:00 2007-09-25T20:00:24-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15336#p15336 <![CDATA[Help with searching for words (for a data base)]]>

Code:

'Revised, untested.CLS DO COLOR 10, 0 LOCATE 5, 15 PRINT "DATABASE" LOCATE 22, 5 PRINT "(1) SEARCH" LOCATE 22, 30 PRINT "(2) ADD" DOkp$ = INKEY$ LOOP UNTIL kp$ <> INKEY$IF kp$ = "1" THEN SearchPIF kp$ = "2" THEN AddPLOOP    'This is the end of the menu SUB AddPCLSCOLOR 10, 0INPUT "Name:", name$ INPUT "Age:", age$ INPUT "Personality:", per$ INPUT "Pasttime(s):", past$ INPUT "Comment:", com$ OPEN "database.txt" FOR APPEND AS #1 PRINT #1, name$, age$, per$, past$, com$ CLOSE #1 END SUBSUB SearchP'This searches for files CLS OPEN "database.txt" FOR INPUT AS #1 INPUT "Search by persons name:", SearchName$ DO INPUT #1, name$, age$, per$, past$, com$  IF SearchName$ = name$ THEN PRINT name$, age$, per$, past, com$ LOOP UNTIL EOF(1)CLOSE #1 END SUB

Statistics: Posted by Patz QuickBASIC Creations — Tue Sep 25, 2007 8:00 pm


]]>
2007-09-25T15:01:55-05:00 2007-09-25T15:01:55-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15333#p15333 <![CDATA[Help with searching for words (for a data base)]]>

Statistics: Posted by Sinuvoid — Tue Sep 25, 2007 3:01 pm


]]>
2007-09-25T14:44:52-05:00 2007-09-25T14:44:52-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15332#p15332 <![CDATA[Help with searching for words (for a data base)]]>
..what should i do?
What you should do is work on something easier. Your code had so many problems I couldn't explain them one at a time.

If you insist on working on something that is over your head, you can use the code I put below for a starter.

Mac

Code:

CLS' menumenu:CLSDOCOLOR 10, 0LOCATE 5, 25PRINT "DATABASE OF HUMANS"LOCATE 20, 55PRINT "(2) ADD"LOCATE 20, 5PRINT "(1) SEARCH"'my INKEY statmentkp$ = INKEY$IF kp$ = "2" THEN GOTO addpIF kp$ = "1" THEN GOTO searchp'This is the end of the menuLOOP'This adds people to the databaseaddp:CLSCOLOR 10, 0INPUT "Age:", age%PRINTLINE INPUT "First Name:", firstname$PRINTLINE INPUT "Last Name:", lname$PRINTLINE INPUT "Personality:", per$PRINTLINE INPUT "Pasttime(s):", past$PRINTLINE INPUT "Comment:", com$OPEN "database.txt" FOR APPEND AS #1WRITE #1, age%, firstname$, lname$, per$, past$, com$CLOSE #1GOTO menu'This searches for peoplesearchp:DO  CLS  LINE INPUT "Search by persons first name:", ffname$  ffname$ = UCASE$(LTRIM$(RTRIM$(ffname$)))  OPEN "database.txt" FOR INPUT AS #3  Found = 0  DO WHILE NOT EOF(3)    INPUT #3, age%, firstname$, lname$, per$, past$, com$    IF ffname$ = UCASE$(LTRIM$(RTRIM$(firstname$))) THEN      PRINT age%, firstname$, lname$, per$, past$, com$      Found = 1    END IF  LOOP  CLOSE #3  IF Found = 0 THEN    LOCATE 2, 1    PRINT "Not Found"  END IF  DO    LOCATE , , 1: PRINT "Try Again?(y/n): ";    kp$ = INPUT$(1)    PRINT kp$    kp$ = UCASE$(kp$)    IF kp$ = "N" THEN END  LOOP WHILE kp$ <> "Y"LOOP

Statistics: Posted by Mac — Tue Sep 25, 2007 2:44 pm


]]>
2007-09-25T06:15:05-05:00 2007-09-25T06:15:05-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15331#p15331 <![CDATA[Help with searching for words (for a data base)]]>

Code:

CLS' menumenu:CLSDOCOLOR 10, 0LOCATE 5, 25PRINT "DATABASE OF HUMANS"LOCATE 20, 55PRINT "(2) ADD"LOCATE 20, 5PRINT "(1) SEARCH"'my INKEY statmentkp$ = INKEY$IF kp$ = "2" THEN GOTO addpIF kp$ = "1" THEN GOTO searchp'This is the end of the menuLOOP'This adds people to the databaseaddp:CLSCOLOR 10, 0INPUT "Age:", age%PRINTINPUT "First Name:", firstname$PRINTINPUT "Last Name:", lname$PRINTINPUT "Personality:", per$PRINTINPUT "Pasttime(s):", past$PRINTINPUT "Comment:", com$OPEN "database.txt" FOR APPEND AS #1PRINT #1,age%, firstname$, lname$,per$, past$,com$CLOSE #1GOTO menu'This searches for filessearchp:CLOSE #3CLSfoundp = 0OPEN "database.txt" FOR INPUT AS #3namefile$ = UCASE$(LTRIM$(RTRIM$(namefile$)))INPUT #3, age%,firstname$, lname$, per$, past$, com$INPUT "Search by persons name:", namefile$searchf:IF RTRIM$(namefile$) = RTRIM$(firstname$) THENfoundp = 1PRINT age%,firstname$, lname$, per$, past, com$GOTO tryagainELSEGOTO searchfEND IFDOnotf:LOCATE 2, 1PRINT "Not Found"tryagain:DOLOCATE 3, 1PRINT "Try Again?(y/n)"kp$ = INKEY$IF kp$ = "y" THEN GOTO searchpIF kp$ = "n" THEN ENDCLOSE #3LOOPLOOP

Statistics: Posted by Sinuvoid — Tue Sep 25, 2007 6:15 am


]]>
2007-09-25T06:05:08-05:00 2007-09-25T06:05:08-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15330#p15330 <![CDATA[Help with searching for words (for a data base)]]>

Statistics: Posted by Sinuvoid — Tue Sep 25, 2007 6:05 am


]]>
2007-09-24T21:00:24-05:00 2007-09-24T21:00:24-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15328#p15328 <![CDATA[Help with searching for words (for a data base)]]> You have serious problems with your input and output to/from the file.

PRINT #1, "Age:"; age%, "First Name:"; firstname$, "Last Name:"; Lname$
PRINT #1, "Personality:"; per$
PRINT #1, "Pasttime(s):"; past$
PRINT #1, "Comment:"; com$

PROBLEM #1: The way you have the above output, you will create 4 separate records. The last 3 records will be for Personality, Pastime and Comment. To keep them all on the samee record, you need a semicolon after Lname$, after per$, and after past$.

PROBLEM #2: Why are you writing the field headings like "Age", "First Name", etc. in front of every data field? Later when you input the record, you will still have the field headings on each record, which means that to search for a field, you have to be able to skip over the field heading with exactly the number of characters that it was written with.

PROBLEM #3: The Age field is written as the first field in the record, but later when you read from the file, you are positioning it as the third field.
INPUT #3, firstname$, lname$, age%, per$, past$, com$

PROBLEM #4: You use "INPUT #3" to read the records and you used comma delimiters when you wrote the record. This is is tricky stuff. I never use "INPUT #" because I've had problems with this. Like what happens if the user enters multiple pasttimes with spaces?

I only use "LINE INPUT" after having formatted each output record in a fixed format. But, I hope you can get it to work for you.

Regards..... Moneo

Statistics: Posted by moneo — Mon Sep 24, 2007 9:00 pm


]]>
2007-09-24T18:41:58-05:00 2007-09-24T18:41:58-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15327#p15327 <![CDATA[Help with searching for words (for a data base)]]>
lmao, you dont understand my question =P what is the difference between .fil and .txt?

he was right....there is no difference i just named it that way cause i want to....you can give any file you want any extension you want...

.boo
.too
.you
.xyz

Statistics: Posted by sid6.7 — Mon Sep 24, 2007 6:41 pm


]]>
2007-09-24T18:40:26-05:00 2007-09-24T18:40:26-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15326#p15326 <![CDATA[Help with searching for words (for a data base)]]> on the first try you close the file.....then you re-open
and look at the first record again...an endless loop

you need to close the file ONLY when you've FOUND the record...

so if you dont find it you need to go read a new record..not close the file...



i think...

Statistics: Posted by sid6.7 — Mon Sep 24, 2007 6:40 pm


]]>
2007-09-24T18:04:12-05:00 2007-09-24T18:04:12-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15325#p15325 <![CDATA[Help with searching for words (for a data base)]]> my code now

Code:

CLS' menumenu:CLSDOCOLOR 10, 0LOCATE 5, 25PRINT "DATABASE OF HUMANS"LOCATE 20, 55PRINT "(2) ADD"LOCATE 20, 5PRINT "(1) SEARCH"'my INKEY statmentkp$ = INKEY$IF kp$ = "2" THEN GOTO addpIF kp$ = "1" THEN GOTO searchp'This is the end of the menuLOOP'This adds people to the databaseaddp:CLSCOLOR 10, 0INPUT "Age:", age%PRINTINPUT "First Name:", firstname$PRINTINPUT "Last Name:", lname$PRINTINPUT "Personality:", per$PRINTINPUT "Pasttime(s):", past$PRINTINPUT "Comment:", com$OPEN "database.txt" FOR APPEND AS #1PRINT #1, "Age:"; age%, "First Name:"; firstname$, "Last Name:"; lname$PRINT #1, "Personality:"; per$PRINT #1, "Pasttime(s):"; past$PRINT #1, "Comment:"; com$CLOSE #1GOTO menu'This searches for filessearchp:CLOSE #3CLSfoundp = 0OPEN "database.txt" FOR INPUT AS #3namefile$ = UCASE$(LTRIM$(RTRIM$(namefile$)))INPUT #3, firstname$, lname$, age%, per$, past$, com$INPUT "Search by persons name:", namefile$IF RTRIM$(namefile$) = RTRIM$(firstname$) THENfoundp = 1PRINT firstname$, lname$, age%, per$, past, com$GOTO tryagainELSEGOTO notfEND IFDOnotf:LOCATE 2, 1PRINT "Not Found"tryagain:LOCATE 3, 1PRINT "Try Again?(y/n)"kp$ = INKEY$IF kp$ = "y" THEN GOTO searchpIF kp$ = "n" THEN ENDCLOSE #3LOOP

Statistics: Posted by Sinuvoid — Mon Sep 24, 2007 6:04 pm


]]>
2007-09-24T17:12:07-05:00 2007-09-24T17:12:07-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15324#p15324 <![CDATA[Help with searching for words (for a data base)]]> Statistics: Posted by Sinuvoid — Mon Sep 24, 2007 5:12 pm


]]>
2007-09-24T16:43:52-05:00 2007-09-24T16:43:52-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15322#p15322 <![CDATA[Help with searching for words (for a data base)]]> Statistics: Posted by ThemePark — Mon Sep 24, 2007 4:43 pm


]]>
2007-09-24T15:02:36-05:00 2007-09-24T15:02:36-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15320#p15320 <![CDATA[Help with searching for words (for a data base)]]> Statistics: Posted by Sinuvoid — Mon Sep 24, 2007 3:02 pm


]]>