ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
I would use a cookie lifetime of 0 seconds, default setting. Removes the cookie upon browser closing. Only when they check a "remember me" of some sort would I change the cookie lifetime. session_set_cookie_params (needs to be called before session_start) allows you to change the cookie lifetime of a session.
-
Why do you need to use PHP with C#? Why not use ASP.NET?
-
Why use PHP? Surely JS is better suited to the task. Why so many fields? Consider an interface like this: [ enter number 1 ] [ enter number 2 ] [ + ] [ - ] [ x ] [ / ] Each of the [ + ] [ - ] [ x ] [ / ] is a submit button. <input type="submit" name="operator" value="+"> <input type="submit" name="operator" value="-"> ..
-
Because if you copied jesirose's code then it's already fixed. Obviously the double will only be in your code, not hers.
-
tuple in the context of SQL is a "row" (more detailed explanation). The OP's question is however too vague to deduce anything from it.
-
HAVING only works with a GROUP BY-clause. It can not be used independently. Edit: Could this solve your problem? http://dev.mysql.com/doc/refman//5.5/en/fulltext-search.html#c1502
-
Something like this: $strarray = implode(',', array_filter($VAROFARRAY, 'intval')); $sql = " SELECT name FROM categories C JOIN products P ON P.catID = C.id WHERE P.id IN($strarray) ";
-
That's because FULLTEXT search requires 2 things: 1) a FULLTEXT index 2) the special syntax MATCH(col) AGAINST(val) That's because you are using AND, if you replace it with OR it will return all rows that give a match. This will put Outback in the result but not at the top. To do this you will need to rank each row and sort the result by that rank. Something like (untested): SELECT *, (IF($name LIKE '$name', 1, 0) + IF($food LIKE '$food1', 1, 0) + ..) AS rank .. WHERE $name LIKE '$name' OR $food LIKE '$food1' OR $fastfood LIKE '$fast' OR $pricerange LIKE '$price' ORDER BY rank DESC A more extensive/correct answer can be found here: http://stackoverflow.com/a/2108493
-
private function rollDiceExempt($sides, $doNotRoll = array()) { $dice = mt_rand(1, $sides); if(isset($doNotRoll)) { Just wanted to point out that the isset() in the above code is always true. Remove the if(isset($doNotRoll)) line and update the lines below to: if(is_array($doNotRoll) && in_array($dice, $doNotRoll)) { $dice = $this->rollDiceExempt($sides, $doNotRoll); return $dice; } else { return $dice; }
-
I think you are referring to Doctrine 2. Doctrine 1.x is far better documented. As an alternative you can try Propel.
-
SELECT home.team_name, visitor.team_name, game_date, IF(game_home_score > game_visitor_score, 'W', 'L') AS WinLose FROM game INNER JOIN team home ON home.team_id = game_home_team INNER JOIN team visitor ON visitor.team_id = game_visitor_team WHERE game_home_team = ? OR game_visitor_team = 6 ORDER BY game_date ASC; EDIT: use Barand's solution, it's more extensive.
-
Error with new website when hosted?? Please help
ignace replied to lewisdow123's topic in PHP Coding Help
Can you try re-uploading the code to your FTP server? I have checked home.php (and the files that are included in home.php) and it contains no parse errors. -
We are going to need to see your tables and their columns to tell you the appropriate query. You shouldn't have to use a PHP function to count this for you. MySQL can tell you these easily.
-
If you feel uncomfortable making these changes then you can always head on over to the freelancing section and let someone make these changes for you.
-
Obviously I refer to the entire line 91: $year = trim($schedule->find('select[id=seasonDropdown]', 0)->find('option', 0)->innertext); Must be replaced with above mentioned code.
-
Can't you just contact the person who wrote this script for you? Maybe he already has an updated version? Yes, but 1) create a backup first 2) you have to replace ALL instances where they try to retrieve information from the website, which means you'll need some tools which can be found by pressing F12 in Firefox or Chrome to get the developer console.
-
So why don't you?
-
You need to find all instances in the code like: select[id=seasonDropdown] All of these needs to be changed so that it matches the expected text. To give you an example: $year = trim($schedule->find('ul[class=schedules-nav-dropdown-item-content-ul]', 0)->find('li', 0)->innertext); Would give you the first year in the year dropdown for the new layout. Not tested.
-
Export to Excel - A little help required Im almost there
ignace replied to notonurnelly's topic in PHP Coding Help
/full/path/to/php.exe /full/path/to/php/file.php -
Export to Excel - A little help required Im almost there
ignace replied to notonurnelly's topic in PHP Coding Help
Replace this: header("Content-Type: application/vnd.ms-excel"); header ("Content-Disposition: attachment;fielname=extraction.xls"); header("pragma:no-cache"); header("Expires:0"); print "$header$data"; With: file_put_contents('/path/to/file.xsl', $header . $data); -
Can you please keep this to 1 thread! http://forums.phpfreaks.com/index.php?topic=362603.0 http://forums.phpfreaks.com/index.php?topic=362598.msg1715503#msg1715503
-
SELECT col, COUNT(col) FROM table GROUP BY col
-
That's a bad idea. Imagine someone who wants to abuse the form would only have set the same question id and pre-fill the answer, eureka! Instead store the correct answer in the session instead of the form.
-
Read the manual: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html DATEDIFF() is a mysql function.
-
Different ways of building a site HTML, PHP, MySQL+PHP,...
ignace replied to chiba's topic in Application Design
Yes. The reason being is that if your website changes (re-design for example) should not include editing the content in your database. Storing everything in the DB has certain drawbacks you may not be aware of. For example imagine the client asks you to display his latest tweets on his website in real-time. You can't put it in your DB.. so this means you will have a copy of your website in the DB and now also on the file system for those pages that require the tweets. This is just off the bat, I am sure there are more drawbacks, but I imagine you now understand when storing your entire website in the DB is not a good idea.