Set apart functions
What is good way: Keep all functions in one file or to set apart them? (like database.php, session.php) Thanks in advance ...
What is good way: Keep all functions in one file or to set apart them? (like database.php, session.php) Thanks in advance ...
Hello. I have a from with a checkbox, and depending on the checkbox state 2 different divs are shown. var alias = document.getElementById('alias'); var list = document.getElementById('list'); if(document.getElementById('isList').checked) { alias.style.display = 'none'; ...
I am using the PHP readfile function to read a file and print it like so: print readfile ('anyfile'). This works, but the content length of the file is added at the end of the string also. Why? ...
Hi guys, We're building a PHP app based on Good old MVC (codeigniter framework) and have run into trouble with a massive chained action that consists of multiple model calls, that together is a part of a big transaction to the database. We want to be able to do a list of actions and get a status report of each one back from the functio...
Hi Hopefully someone here might have an answer to my question. I have a basic form that contains simple fields, like name, number, email address etc and 1 file upload field. I am trying to add some validation into my script that detects if the file is too large and then rejects the user back to the form to select/upload a smaller file...
Hey guys. I need help for a project for school. Essentially, I need to write a program that sends newsletters. I can send the newsletters and stuff, but the main issue I'm having is that the newsletter needs to contain things that are contained in a database. How exactly do I draw those things and put them into a newsletter? The bulk of ...
I am trying to get the page or last directory name from a url for example if the url is: http://www.example.com/dir/ i want it to return dir or if the passed url is http://www.example.com/page.php I want it to return page Notice I do not want the trailing slash or file extension. I tried this: $regex = "/.*\.(com|gov|org|net|mil|edu)/...
How would I print the results of a form submission on the same page as the form itself? Relevant hook_menu: $items['admin/content/ncbi_subsites/paths'] = array( 'title' => 'Paths', 'description' => 'Paths for a particular subsite', 'page callback' => 'ncbi_subsites_show_path_page', 'access arguments'...
Hi! Just like the title, how would a multiget from memcache look like? Is this the correct way of utilizing multiget? : $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); $var = $memcache_obj->get(Array('some_key', 'second_key')); Thanks UPDATE: anyone looking to do the same, check out this addition as w...
Hey everyone! I was hoping to start using Magento for a very simple checkout landing page. I have a few questions regarding the capabilities of Magento: 1) I don't actually want to use the 'add to cart' button but rather a 'buy it now' button. So when a user clicks to purchase a product it automatically takes you to the checkout proc...
I am looking to execute this statement via Zend Framework. As I understand it, I can use Zend_Db_Select. Is it possible to use Zend_Db_Table? Three tables: classes, students, and class_students select classes.name, students.student_id, students.fname, students.lname from students, classes, class_students where class_students.student_id...
Hey there! I have a few Views on my Drupal 6 site which take care of some of a node's fields. For example, I have a content type called Country, which has a field called Capital. I've excluded this field in the node display, but there is a view that takes the node ID as an argument and displays it in the right column. This is all very ...
I have a JSON API that I need to provide super fast access to my data through. The JSON API makes a simply query against the database based on the GET parameters provided. I've already optimized my database, so please don't recommend that as an answer. I'm using PHP-APC, which helps PHP by saving the bytecode, BUT - for a JSON API tha...
Hi, I have a local database, and all the tables are defined. Eventually I need to publish my data remotely, which I can do easily with PHPmyadmin. Problem however is that my remote host doesn't allow remote SQL connections at all, so writing a script that does a mysqldump and run it through a client (which would've been ideal) won't hel...
Not sure of the best way to go about this? I want to create a tournament bracket of 2,4,8,16,32, etc teams. The winner of the first two will play winner of the next 2 etc. All the way until there is a winner. Like this Can anyone help me? OK so more information. Initially I want to come up with a way to create the tournament with the...
I'm adding unit-tests to an older PHP codebase at work. I will be testing and then rewriting a lot of HTML generation code and currently I'm just testing if the generated strings are identical to the expected string, like so: (using PHPUnit) public function testConntype_select() { $this->assertEquals( '<select><option value=...
I am creating a website, and have a tabbed horizontal menu. In order to cut back on the number of files I have to edit when I have to make changes to the menu I want to put the navigation in a separate file that I can call using a PHP include statement. When I do this, however, the nav disappears entirely from the page. The rest of the c...
Hello guys, I have a session created which is null when called from an ajax call on Safari. header.php session_start(); $_SESSION['test'] = 'this is my session'; mypage.php session_start(); echo $_SESSION['test']; <-- NOT WORKING ON SAFARI Thanks ...
I'm trying to get an array of events from Google Calendar using the Private URL. I read the Google API document but I want to try doing this without using the ZEND library since I have no idea what the eventual server file structure is and avoid having other people edit the codes. I also did a search before posting and ran into the sam...
A URL redirects to another link. How do I know which link it gets redirected to with PHP and JS? And is finding the filesize of the new link possible too, without complete transfer of the file? Thanks in advance. ...