Jump to content

Perad

Members
  • Posts

    287
  • Joined

  • Last visited

    Never

Everything posted by Perad

  1. Query is "INSERT INTO `content` ( `id` , 'order', `location` , `content` , `page` , `publish` , `title` , `plugin` ) ..." I know it can be done. What speech marks do I need around the column order to convince mysql that its not a reserved word and is actually a column.
  2. Could you clarify. Do you want help getting the data from the database or setting up a navigation which runs off post data?
  3. Are you using PHP4 or 5? How are you getting the mentor name? if ($mentorName == '') { print '' // or print 'Unselected' etc etc } else { print "<a href='display.php?id=$mentor' title='Get info on character: $mentorName'>$mentorName</a>" }
  4. http://uk.php.net/str_replace - Can be used to strip out the .something $extensions = array(".something", ".somethingelse"); $unextended = str_replace($extensions , "", $file); // hello.something becomes hello Alternatively http://uk.php.net/explode - Can explode the strong around the . $parts = explode('.', $file); // hello.something $unextended = $parts[0]; // parts[0] = hello; parts[1] = something
  5. You need an e-mail server. This is not included with WAMP. Check out this. http://www.postcastserver.com/ It is beyond me why you would want to send e-mails from your computer. This is what web servers are for.
  6. Please rephrase your question. Are you talking about creating a virtual world like world of warcraft where characters can move around and interact with one another? PHP cannot do this. PHP can create a static map in which players can take turns to move around. However a persistant world just isn't going to happen.
  7. Hello, I have successfully removed index.php from my sites URL's. I am now looking at cleaning up my sites URL's a little more. I am using codeignitor and my site has 2 controllers. The controller which I really don't like looks like this. domain/workings/index/about Is it possible to rewrite this URL to something a bit more a pretty. Like. domain/about At the same time I don't want the admin controller to be affected. domain/admin/x My .htaccess file currently looks like this. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule> Is what I am asking possible? Any idea how I can achieve this?
  8. Variables print fine. I try to use them 2 lines down and wtf they are not added to the string. The question. How can I add $extention[$ex] to $copyto = $this->config->item('upload_dir') . 'images/'.$newname.'.' How can I add $image to $copyfrom = $this->config->item('upload_dir') . "preview/" print $image.'<br/><br/><br/><br/><br/>'; print $extention[$ex].'<br/><br/><br/><br/><br/>'; $newname = rand('11111111', '99999999'); $copyto = $this->config->item('upload_dir') . 'images/'.$newname.'.'.$extention[$ex]; $copyfrom = $this->config->item('upload_dir') . "preview/" . $image;
  9. I am trying to create a very simple script where I count the form entries and generate a total. This is proving deceptively hard. This is my form. <div class="form_item"> <h3>Add a link to your website for $4</h3> <input type="text" name="website" id="website" onchange="calculate()" value="<?php if (isset($_POST['website'])) { print $_POST['website']; } ?>"/> <h3>Homepage</h3> <p>Be on the homepage and be seen by hundreds of people</p> <input type="checkbox" id="homepage" onchange="calculate()" name="homepage" <?php if (isset($_POST['homepage'])) { print 'CHECKED';} ?>> Home Page Ad (7 Days) <script type="text/javascript"> var total = 0; function calculate() { document.write(document.calcform.website.value); } </script> <h3>Category</h3> <p>Be the first thing users see when they enter your specified category.</p> <select name="duration" category onchange="calculate()"> <option value="">None</option> <option value="3" <?php if (isset($_POST['duration']) == '3') { print 'selected="selected"'; } ?> >3 Days</option> <option value="7" <?php if (isset($_POST['duration']) == '7') { print 'selected="selected"'; } ?>>7 Days</option> </select> </div> The forms name is called calcform. Now what I am trying to do is as follows. > If the website input has got someone thing in it then I want to set total variable to 4. > If the homepage checkbox is ticked I want to add 20 to the total variable. > If the category drop down is set I want I want to multiply 3 by the number of days in the select box. I then need to be able to subtract from the total if the check box is unchecked. The category days are set to 0 and the website box is emptied. Please.. can someone tell me how I can get the value for each of the 3 form fields. Once I know this I am sure that I can work out the rest myself.
  10. Hey, I am trying to copy a file from one folder to another. Could anyone tell me what functions I need to achieve this?
  11. Could someone help me get my head around the mkdir() function. I have the following. $root = getcwd().'/cities/' This is where I want to make the folder. I want to make a folder containing the variable $name. So the folder path will be $root = getcwd().'/cities/'.$name; How do I set this with getcwd. Do I just specify the complete path and it will automatically generate the new folder.. i.e. mkdir($root, 0777); Or is there something more to it? My second question. How can I change folder name with out edited the contents of the folder. Is there another function for this?
  12. You could set the value as... value1|value2 Then use the explode() function separate them later on.
  13. Bear in mind that no outputted code should be above this line. This includes html, spaces etc. The line below automatically forwards a user to the next site. <?php header('Location: http://mysite.com'); ?>
  14. I believe you need to use the strtotime function. This will create timestamp which can then be used to compare the dates with. http://uk3.php.net/strtotime
  15. Use substr(). Then add ... on the end http://uk.php.net/manual/en/function.substr.php
  16. I had a look at that at that page and the usort page. I don't understand it.
  17. Take this array. $content[] = array('online' => $res['online'], 'username' => $res['username'], 'photo' => $res['photo_thumb']); I need to sort the users to decide whether they are online or not. Online is either 'on' or 'off'. I have had a look at the php documentation but have promptly got lost. How can I sort the array so that results with 'online' => 'on' will be at the beginning of the array?
  18. $poll = $_GET['poll']; $user_id = $_GET['user']; if (is_int($poll)) { $poll = 13 The if code does not work. If I change the code to (is_int(13)) Then it works.. Any ideas why this is?
  19. I have this query? $sql = "SELECT * FROM x_poll WHERE category='$poll'"; Is there anyway to return one random result without using php rand?
  20. The problem is that the remote server may not support php and this needs to work on all servers whether they support php or not. Thats why I was thinking about iframes.
  21. I have the following task. Allow users to put code on their website which will show a poll. What I need the script to do is the following... -> Sit on the users homepage. -> Connect to my server and request poll details -> When form is submitted send option to my form, request poll results. -> Show poll results. I am thinking about using iframes. <iframe src="http://site.com/poll.php?id=..."></iframe> Now, would this work with iframes? Whether it would or not does anyone know a better method which isn't iframe dependent?
  22. Redirect the user to the form and set the values as the $_POST[] variables that they just submitted along with an error message.
  23. You do not need the single quotation marks around the NOW()
  24. Surely on page 2 you can have the following. <meta http-equiv="refresh" content="3;url=http://root/index.php?page=3"> This will then flash up page 2 for 3 seconds then pass the user onto page 3. PHP executes the script. It is not a persistent connection which can count time. You can use this or javascript.
  25. Originally I had this. $this->data[] = array('id' => $row['id'], 'nav_image' => $row['nav_image'], 'name' => $row['name'], 'online' => $row['online'], 'order' => $row['p_order']); This allowed me to call data to by templates by using $function->data['id']['value']; The problem with the function is that it can only do one query and return one set of results. I am trying to allow the function to return any results from any table. My question is. How can I start with this. name|online|p_order And convert it into 'name' => $row['name'], 'online' => $row['online'], 'p_order' => $row['p_order'],
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.