Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Why not order by parentid
  2. ooooohhhh If you have been programming for years then you should know that this is bad practice <?=
  3. However it requires more code by just using the title and not using a key at all. It would be a bad idea to query the database on a varchar field with a string as the table may get large and using text is slow. There is nothing wrong with using the following as a url: http://www.website.com/cars/article/123/ford-fiesta This will get the keyword in the url to help SEO The .htaccess will look as follows: Options +Indexes RewriteEngine On Options +FollowSymLinks -MultiViews # product categories RewriteRule ^cars/article/([0-9]+)/[a-z0-9-]+$ /viewarticle.php?id=$1 [L]
  4. Of course you can if like you said you will use the title to create the url string. Also this is a bad rewrite rule: Using * allows anything through. What you may want to do is use an array map in your code so you can still do the lookup on the database primary key i.e 123 $map[123] = 'ford-fiesta'; $map[463] = 'ford-mondeo'; You can then get the array key from the url from the string to query the database. This is nothing new.
  5. while($row=mysql_fetch_assoc($exeQ1) ){
  6. Yes it is possible. Read up on the ftp functions available in PHP. http://uk3.php.net/manual/en/ref.ftp.php
  7. You only need to extend if you want the program to perform an action if an exception is caught. For instance you may want the exception to be stored in a database, sent as an email or display a specific page to the user. There is no need to create a new extended class for every exception.
  8. Sorry for changing your variables slightly, force of habbit. Here you go: <?php $result = mysql_query("SELECT DISTINCT coder FROM daily_reports WHERE week_no='".mysql_real_escape_string($wkno)."'") or die(mysql_error()); $numRows = mysql_num_rows($result); while($row = mysql_fetch_assoc($result)) { print $row['coder']."<br />"; } ?>
  9. What's wrong with you man! LOL
  10. I think this is impossible on the Linux platform as you would need a COM object to work with Microsoft Word. Windows only!
  11. Only ever seen characters appear when saving files with a unicode signature (BOM) but that is a wierd character that appears before any HTML is outputted.
  12. Hmm never had this before. If the users web browser is still open and the connection drops and then reconnects it's a possibility that the session will still be active however I have never tested this so you would have to try by switching your router off. You could keep the value active also by storing the data in a cookie and transferring to a session var if detected.
  13. Of course, just requires the correct formula.
  14. Try this <? function convertSerialDate($date) { $timestamp = ($date - 25569) * 86400; return date("d/m/Y",$timestamp); } print convertSerialDate(733535); ?>
  15. Why would you need separate databases for each customer. One database will suffice. Each customer will have a primary key record i.e. customerId customers ******** customerId name Each customer will only view records related to their own customerId. For instance if customers have to login then their customerId is stored in a session. That piece of data is used within the database queries. The code in your application should prevent any information from other customers being displayed for instance if you have to pass parameters in the url that are used to query the database.
  16. Use a cookie to store a piece of data that would keep a user logged in for a period of time i.e. 3 days. Do not store usernames / passwords in cookies! If there is a login to your website set session values after successful login. i.e. session_start() // login was successful $_SESSION['userId'] = "123"; Then on pages where you must be logged in session_start() if(!is_numeric($_SESSION['userId'])) { // redirect to login header("Location:login.php"); exit(); } You can set a value in a cookie to identify the user and log them in on a return visit. Cookies are just text files on the users computer. If you store a password in a cookie then anybody using that computer could read it.
  17. Why don't you read the documentation or search the web. Takes 2 seconds to find info on Google keyphrase: installing ubuntu dual boot http://screencasts.ubuntu.com/Installing_Ubuntu_with_Windows_Dual-Boot
  18. You should use sessions, not cookies to store user data. Without any code it is impossible to see what the issue is.
  19. You should make your urls search engine friendly
  20. That isn't the problem. Assigning a variable to a template is easy yes. He is asking what the url is to his new page for a link in his footer. Read the post. If he uses /about.php then the page does not display correctly.
  21. You will not get a solution as the coder has used his own structure for your website. I'm guessing this is done using an MVC (model, view, controller) pattern. You may need to add a new class method or subclass for this page. My advice would be to copy an existing page. What do the urls look like for other pages? They maybe parameter based.
  22. Because session_start() will start a session. Your protected pages should check for a value within the session and redirect if not found i.e. // check that the customerId value is set in the session if(!is_numeric($_SESSION['customerId'])) { header("Location:login.php"); exit(); }
  23. The first issue is that this is not AJAX. AJAX is used to access a server side script i.e. PHP without the user having to refresh the browser, i.e prepopulate a select list from a database query based on the choice from another form element such as a checkbox. What you have is a Javascript function. Your second issue is that your HTML is incorrect. Checkout the number of HEAD tags you have and where is your BODY tag? 3rd issue <?php echo $PHP_SELF; ?> is defunct and should be <?php echo $_SERVER['PHP_SELF']; ?> 4th issue Your onSubmit event handler is in the wrong place <input type="submit" name="submit" value="submit" onsubmit="return conflag();"> should be <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onSubmit="return conflag();"> 5th issue You cannot acheive this by using the onSubmit event handler. You wouldn't even use Javascript if you are submitting the form. PHP will insert the database record. You cannot display the textareas value using Javascript in the way you have and if you are submitting the form the value is in php's $_POST array so can be printed within the textarea without JS. Simple refactored code <html> <head> <script language="Javascript"> function conflag() { var value = document.getElementById('idconmsg').value; alert(value); } </script> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <textarea id="idconmsg" name="conmsg" cols="50" rows="10" wrap="physical" title="Please type your message" onChange="conflag();"></textarea> </form> </body> </html> I suggest you getting a book. What you are trying to acheive is not logical, you are using the wrong methodology or you haven't explained yourself fully.
  24. Use Google http://bytes.com/topic/javascript/answers/848204-how-get-textarea-value-into-javascript-variable
×
×
  • 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.