htmlentities() works for me.
may be his tests are flawed
htmlentities() works for me.
may be his tests are flawed
Thanks for asking! My solution was a bit unorthodox. Let me attempt to explain--
I could not figure out what was causing the update to stop while the TEXT field was set to null(for the purpose of skipping that field during an INSERT). All other fields that were set to null for the same purpose, did in fact allow the update --except the one where I was concatenating --as illustrated in my post earlier.
I came up with a work around; whereas, instead of setting the field to null, I set it to none-null. And during the insert, I created a hidden field in the originating form with the same name as the one in the db. The value of the hidden field has a single character. Since this field in db is only for updating, during the first update the inserted character will be written over.
Now this work-around addressed the issue. It allowed for INSERTING (while ignoring certain fields, including BLOBs) and UPDATING to the same table. The reason for which the initial suggestion did not work, eluded me; though, I spent nearly an entire day debugging.
As I may guess, this "makes no sense to you"?
Best,
Mossa
Thanks and all the best!
how do you know the active page?
What do you want to do?
What is your level of programming?
put your full code!
what did you do?
Thanks,
I don't expect the user to enter anything but names and numbers, so I guess no harm with filtering.But that doesn't seem to work anyway, I still get XSS upon entering a script in the keyword field, tried str_replace() as well, and it doesn't work, this is confusing!
What is your current code and how do you test it?
Don't sanitize verything. If the field is EMAIL sanitize it as EMAIL filter.
You have to know the type expected!
For your case $keyword= filter_var($keyword, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW); seems to be the right. If you put into my sql don't forget to escape it using mysql_real_escape_string()
There are two inserts
table have columns: col1, col2, col3
--Inserts into all columns, this kind of query should have values equal to number of columns
INSERT INTO table_name("Blah", "bla2", "blah3")
--Insert any number, the other columns should have default defined for safety
INSERT INTO table_name(col1, col2) VALUES("Blah", "bla2")
what are you trying to do?
I have been trying to implement unhtmlentities(), or htmlspecialchars() functions with no success, how can it be done please ??
What is the definition of with no success? You need to be explicit here!
Provide some code that shows your problem, and desired result.
Yeah, a good note! We don't do homeworks or code for you. Grab google, read the manual, write something and then ask for help!
how could i add the onkeydown() function in jquery..
this is for the autocomplete..
regards, ^^
Check JQuery UI auto complete
So? What have you done for your homework?
Remember it is YOUR homework.
In Login:
1. Check if login info are sent if not redirect back to login page with ambiguous error message
2. If logged in check for credentials with ambiguous error message
3. If logged in redirect to members page
you skipped number 1
-- -- Table structure for table `Bible` -- CREATE TABLE IF NOT EXISTS `Bible` ( `Book` int(11) NOT NULL, `Chapter` int(11) NOT NULL, `Verse` int(11) NOT NULL, `Scripture` int(11) NOT NULL, PRIMARY KEY (`Book`,`Chapter`,`Verse`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Table structure for table `Scriptures` -- CREATE TABLE IF NOT EXISTS `Scriptures` ( `Scripture` int(11) NOT NULL AUTO_INCREMENT, `ScriptureText` text CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`Scripture`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
In this schema, Bible.Scripture is a Foreign Key to Scriptures.Scripture. I'm assuming Book, Chapter and Verse all join to other tables in your database already.
The primary key becomes a composite primary key of the columns Book, Chapter and Verse. So it doesn't matter if Chapter and Verse are not unique as long as the three columns combined are unique. This prevents inserting any duplicate records accidentally, which using just an auto-incrementing primary key does not.
Splitting it out into two tables is probably overkill considering you have a hard limit to how much data will actually be contained in the table, but it is an reasonable optimization for MyISAM tables. As per my last post the end result is the bible table can now be sorted in memory instead of on disk. You can read about the difference between fixed with and dynamic row formats here:
http://dev.mysql.com/doc/refman/5.0/en/static-format.html
http://dev.mysql.com/doc/refman/5.0/en/dynamic-format.html
Mhh!
Let me digest this first!
Thanks
-evstevemd
My suggestion was regarding the structure of your table.
The three columns Book, Chapter and Verse together make a perfect primary key eliminating the need to create a surrogate primary key (ID in your table).My other suggestion, would be to split the actual scripture text out into a second table and join it to the Bible table. Reason being, mysql will use a dynamic row format when it encounters columns with a variable length, like TEXT or BLOB, so sort operations have to occur on disk instead of within memory. This is exponentially slower. Since your sort operations would most likely be against book, chapter or verse columns, this would drastically speed up your queries.
thanks MS,
so what schema are you suggesting? Remember Book is Unique but Chapters and verses are repeatable!
Thanks all friends!
I think I missed UNION to concatenate SELECT queries as you haves shown.
Thanks everybody and I assume the problem is finished
I'm very sorry. I thought I was posting this link:
http://stackoverflow.com/questions/1365678/selecting-a-range-of-rows-using-3-different-indices
The Link have exactly same problem as mine but the man didn't said if he conquered!
Just a general observation, feel free to ignore the following.
In your table you're using a surrogate primary key, the auto-incrementing column. When you clearly have a natural and practical composite primary key in (book, chapter, verse) as they are always provided and the combination of three digits may not ever repeat.
The glaring issue I see with using a surrogate key in this scenario is that a record can be mistakenly added with duplicate information.
e.g.
ID, Book, Chapter, Verse, Scripture
1, 1, 1, 1, ...
2, 1, 1, 2, ...
3, 1, 1, 1, ...By eliminating the ID column it becomes impossible to insert the third record with the duplicate information as the composite pk fails.
Book, Chapter, Verse, Scripture
1, 1, 1, ...
1, 1, 2, ...
1, 1, 1, ...
Thanks, but I have not grasped what you want to say!
I'm very sorry. I thought I was posting this link:
http://stackoverflow.com/questions/1365678/selecting-a-range-of-rows-using-3-different-indices
Ahha! I get it!
Apart from what I have said above, there is another way if you if you do not have the ID's in sequence. An autoincrement would usually put the ID's in sequence as long as you have added the data in the proper order.
But if you have not, here is another solution. Create a new column in the table and give it a name say `id_ord`.
You will have to create formula so that the book 1, Chapter 2 and Verse 4 are integrated. e.g.
id_ord = Book * 100000 + Chapter * 1000 + Verse
Store the above value in the 'id_ord' in the DB. Using this, you can create the values from your PHP code for the from and the to id_orders when a request is given. for e.g. A user asks for scriptures between book 1 chapter 1 verse 1 and book 2 chapter 3 Verse 1.$idOrd_from = 1*100000+1*1000+1 = 101001 and
$idOrd_to = 2*100000+3*1000+1 = 203001
You should now be able to pull the scriptures between these 2 id_ord
To add this into your DB use the following query
UPDATE bible SET id_ord=100000*book+1000*chapter+verse;
Hope this helps.
Thanks, but I admit I haven't understood
I would say this is one of those problems that can't be solved with one query.
Couldn't you just select the first id:
SELECT `id` FROM `bible` WHERE `book` = 1 AND `chapter` = 1 AND `verse` = 1 LIMIT 1
and the second:
SELECT `id` FROM `bible` WHERE `book` = 2 AND `chapter` = 3 AND `verse` = 1 lIMIT 1
Then get the results via:
SELECT `scripture` FROM `bible` WHERE `id` BETWEEN [id_1] AND [id_2] ORDER BY `book` ASC,`chapter` ASC,`verse` ASC
[edit]
Sorry I pretty much said what the others above me said. I guess I should of read the other posts before responding.
Thanks KK,
I missed you all the times you were not here!
Can you do 1 query to get the IDS (say, Genesis 1:1 = ID 1, Psalms 2:30 = ID 4562), then ask for anything between IDs 1 and 4562? I think that's what ~sudeep was thinking.
As long as the verses were entered in order, it should work.
Otherwise, I think you'll have to do a book-by-book query.
Noted, thanks a lot!
pritaeas,
isn't this a link to this same post?
Are your ID's in the order as per the sequence of the Books, chapters and verses in the bible? If so, then you can pull the ID for from where you want to start and the ID till where you want to get the Scripture till and then pull all the scriptures in between the 2 ID's.
sudeep,
id is autoincrement and I don't programatically know where new book or chapter begins at as far as ID is concerned.
Thanks for replying
Hi,
I know this is not PHP issue but we here writes a lot of database SQL querries so I hope for a help. I have a bible script that is supposed to query the scriptures between two intervals. My table is named Bible and have columns: ID (int), Book (int), Chapter(int), Verse (int) and Scripture(text).
Now the books are unique ie 1-66 but chapters keep repeating, and so do verses. Now suppose I want to get scripture between book 1 chapter 1 verse 1 and book 2 chapter 3 Verse 1, how do I go about? My knowledge of SQL have taken me to a dead end!
You can check how bible have its chapters and verses arranged at www.biblegateway.com.
Thanks friend :)
thanks friend
A general solution is to use a class library such as Qt4 available from http://qt.nokia.com/. Here you'll find general classes for accessing all major RDBMS's (Oracle, MySQl, SQlite etc...). Qt is great...
Specifically for Oracle, a more difficult, but high performance method is the OCI or OCCI API available from oracles website for free.
The problem is, I have learned great deal of wxWidgets and I don't plan to learn QT for now. I have invested a lot of time in learning wx. May be when only alternative is QT ;)
Thanks
thanx for all those information.. but I am only into open source technologies. and my programming language is limited in php. So is it impossible to make such a project using PHP??
Learn Python and access TAPI via Pywin32 Module!
Well i honestly think that Code Blocks is the most kickass program honestly .
Nothing is bad about C::B. I used it for long time and enjoyed. When I tasted CodeLite, I got lost to its world. Try it and tell me :)
I would suggest you check desktop application!
Though it might be possible, it would we tough task.
Right tool for the right job. Some toolkit have mobile version which abstracts you from much of pain
#include <odbcinst.h>
#include <sql.h>
#include <sqlext.h>I can't imagine you have any C++ installation without these files.
They are there On Mingw. I hope there will be too in my GCC in Ubuntu!
Thanks a lot.
Now I have to find ODBC tutorial!
What CMS you are using now?
None so far!
Although I have tried Joomla/Drupal/Wordpress
can't you just install any of those packages (the one you prefer) and then reverse-engineer the db design since that is all you want. You should be able to generate a diagram using MySQL workbench:
http://dev.mysql.com/downloads/workbench/
I have already tried that long ago and it got me some tables but relationships are lost. Did I miss something?
Is that worse than friend or static functions in each class? I guess I'm missing something about your problem
Ok let me weigh the consequence of both approach again and I will go to simplest!
Getters/Setters in Each class?
I was trying to avoid that!
Hi,
I have a complex C++ code with gui. Each major gui division is independent class. Now these classes must 'talk' sometimes in operations like copy from division A and paste in division B. So I need to pass some pointers from one class to another.
I was thinking of using friend methods but I see that I have to pass object each time I call the function which complicates stuffs.
I thought then of static function but then, my pointers will have to be static and I see it will complicate stuffs. I decided to ask if anyone have met this challenge of inter class communication and how to resolve it!
Thanks a lot
thanks Fred, I will check gcc installation
thanks again Freddy. AFAIK, Odbc is not part of C++ standard so it is neither in Mingw or Linux GCC. So where do I download headers/sources to compile? Or even ready .a and .h?
Thanks
I was finding Database schema for CMS that are already there (Drupal, Joomla et al) but not yet succeeded. I would be happy if anybody points me to it. I want to adopt for my uses, droping this and adding that!
Thanks
since \t is equal to 4 spaces (sometimes 8 spaces) why not add 4/8
<?php
for($i=0;$i<5;$i++)
{
echo " Ramesh is learning PHP"."<br/>";
}
?>
where is your new code?
I need to see it so that I can comment
Thanks Fred!
Where do I download headers/libraries plus examples?
Is it the same as UnixODBC or are different?
I would like to see your wrapper!