
ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Am I just bad at math, or is my calculator wrong?
ignace replied to 3raser's topic in PHP Coding Help
No you are correct! The number 306150 remains constant because you don't subtract anything from it. And how do you kill a Black Demon 0.0149175240895 or 0.403253307202 times? -
1. Each exhibitor can have multiple animals You have turned this relation the other way around as it should be: exhibitor (exhibitor_id, ..) animal (animal_id, exhibitor_id) I assume each show also has multiple animals: animal (animal_id, ..) show (show_id, ..) animal_show (animal_id, show_id) both keys in animal_show are primary, that is, assuming each show is present only once in the shows table (on a different date) otherwise you'll have to add a date column to the table as part of the primary key. Same as with 2 (same assumptions) show (show_id) winner (winner_id) show_winner (show_id, winner_id)
-
You can as easily write the application in procedural as you can in OOP, it's all just a matter of preference and opinion.
-
You shouldn't worry about micro-optimization because it won't help you if: 1) you have a query on a big table with wrong indexes 2) you used the wrong engine for your table so it locks up every time someone writes to it .. Analyze your code under load, find bottlenecks and solve them!
-
So if users always need to use prepared statements then why is it possible to execute a query that doesn't use them? You should only use prepared statements when you are to execute the same query multiple times with different variables. Using prepared statements merely to avoid SQL injection is over-kill as you could escape it easily yourself in the provided interface.
-
Great work on the website and the class with a few remarks on the latter: 1) UseSQL would possibly be more useful if you allowed it to connect to more RDBMS then only MySQL (eg. extend PDO and make it a Database Abstraction Layer) 2) Don't mix HTML into your class 3) Use Exception's instead of letting your class handle any and all error's 4) Nearly no data is being filtered before being written to the database exposing anyone who uses your class to SQL injection 5) You assume an "id" convention, bare in mind that not everyone uses pseudo-keys Nevertheless I applaud your effort, keep up the good work!
-
If the above view is your vision on PHP programming then helping you is the worst thing one can do. Buy a book and learn PHP first you are a long way from home.
-
header("Location:" . $xml->result[0]->redirect_url);
-
get list of processes running on client machine
ignace replied to dmikester1's topic in PHP Coding Help
Yes, but this will only work with IE and you'll also need a good dose of VBA to pull it off. -
How: SHOW TABLES FROM <database>; SHOW CREATE TABLE <table>; SHOW COLUMNS FROM <table>; What: Use mysql_unbuffered_query() to read the row and insert the row into the new table on the remote host.
-
<input type="submit" name="action" value="Preview"> <input type="submit" name="action" value="Save"> <input type="submit" name="action" value="Delete Post"> <?php echo $_POST['action']; // Preview, or Save, or Delete Post ?> Not sure if this works cross-browser.
-
In your .htaccess create a 301 redirect from / to /index I'll have to see your full code of your IndexController and your Routes in order to be able to give you a different answer.
-
Glad I could help
-
Too bad you can't create a MySQL partition and tell MySQL to store all revisions on the other partitions
-
Everything depends on how you want to use the data. Most certainly you want to avoid people specify invalid class names so your database should be something like: CREATE TABLE Classes ( class_id VARCHAR(32) NOT NULL, -- class name PRIMARY KEY (class_id) ) ENGINE=INNODB; CREATE TABLE Characters ( character_id VARCHAR(32) NOT NULL, -- character name class_id VARCHAR(32) NOT NULL, .. PRIMARY KEY (character_id), FOREIGN KEY (class_id) REFERENCES Classes (class_id) ON UPDATE CASCADE ) ENGINE=INNODB; If you are playing against a specific version then you could use: CREATE TABLE Characters ( character_id VARCHAR(32) NOT NULL, -- character name class_id ENUM('<class-id-1>','<class-id-2>') NOT NULL, .. PRIMARY KEY (character_id) ) ENGINE=INNODB; This makes it easy to manage it from a back-end. The first example will allow you to easily also add classes the second one doesn't and will make it costly to do so. I do not recommend using a config file instead you could use: class RaceClass { private $validClasses = array( .. ); }
-
Why do you need to have everything in the IndexController? If you create a controller for each of those you already have the desired result and closer to a correct implementation: class FooController extends Zend_Controller_Action { function indexAction() {} } class BarController extends Zend_Controller_Action { function indexAction() {} } domain.top/foo domain.top/bar
-
It seems their is "Audit Trails" as found on MySQL forums: http://forums.mysql.com/read.php?20,271696,271699#msg-271699
-
We need some more information regarding what you are trying to achieve. You can use HeidiSQL if you want to transfer data manually from remote host to remote host or MySQL supports Replication if you want data to be always copied from one database to another.
-
Copy-pasting won't get you anywhere. If you would have taken the time to look up triggers you would have found that it was missing a ; after the insert statement and you need to specify a different delimiter then the default one. True, but this was the most simplest design I could come up with at the time. Another approach would be the one Wordpress employs each revision is a descendant of the current version as discussed on Wordpress Codex: Revision Management. Are there any SQL patterns for this particular problem? Or better solutions available then the one presented by Wordpress?
-
It should be noted that it's up to you to implement that only one given person is allowed to edit a specific post at any given time (to avoid 2 people overwrite each others work and both are given a different revision or you could complicate it more and implement merging and conflict resolution).
-
CREATE TABLE Posts ( post_id .. ); CREATE TABLE PostsRevisions ( post_id .. version .. AUTO_INCREMENT, .. PRIMARY KEY (post_id, version) ); CREATE TRIGGER CreatePostRevision BEFORE UPDATE ON Posts FOR EACH ROW BEGIN INSERT INTO PostsRevision (..) VALUES (OLD.<column-name>, ..) END; This will keep the current revision in the Posts table and available revisions in the PostsRevisions table.
-
Destroying a specific session works best if you store it in a database using session_set_save_handler. Using this technique also gives you other advantages like ban/log-out a user, in-place access-control editing, ..
-
Globals are bad as you already knew. Singleton and Registry are globals.
-
Don't know what this script does, can someone enlighten me please?
ignace replied to krisw's topic in Third Party Scripts
l() is a strtolower() wrapper. a() is a "clever" way not to use an array() $w is thus in the end an array. In summary it shows a known link to certain IP-address possibly spiders who seek for and report hacked websites.