Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. I love that. It's what computer sales people always say when you ask which one is better. Well sir, it depends what you want to use it for'. Well I was thinking about a drinks tray, something for the dog to fetch and bring back, and also a ramp for my sons' remote control car to jump over.
  2. No, because Google will just see the homepage as duplicate content as it is referenced by multiple urls. Your homepage will probably get penalised and the indexed urls will be put in the sandbox. The best solution is to keep the content of your current pages, even if you put them on another website completely under new urls. Use 301 redirects from your old URLs to them. Then ,on these pages add anchor text links to your new website to help pass through PR and traffic.
  3. I was having a similar dilema. Should I go for this: http://hadshot.net/apple/wp-content/uploads/2008/11/real-apple.jpg or this: http://gallery.techarena.in/data/511/apple-macbook-screen.jpg I decided on the first one because I preferred the colour!
  4. OK so if you are running this query first to check for an existing record: <?php $result = mysql_query("SELECT * FROM fallLeague10 WHERE nameFirst='$nameFirst' AND nameLast='$nameLast' AND school='$school'"); ?> If a result does exist, what data do you want to update as opposed to inserting a new record.
  5. Your code isn't going to work unless you have the correct database structure
  6. windows or linux?
  7. Im not getting your database structure. Why would you have 2 tables containing the same fields and data? You are selecting from 'fallLeague10' and then inserting into 'fallLeague09reg'. If there is a record found in 'fallLeague10' what table do you want to update and how are you obtaining the records' primary key?
  8. yep, just add it in. you have marked the correct place. your insert query goes within the else (not elseif) condition.
  9. What do you mean by recognising? Are you getting an undefined function error? Have you done a simple echo test i.e <?php if(!isServer()) { print "not my server"; exit(); } ?> On another note, remove the braces from return values! <?php function isServer() { if ($_SERVER['SERVER_NAME'] == 'myservername') { return true; } return false; } ?>
  10. This is totally incorrect. Since you are only selecting one car, there should not be any loops at all, both in your php file view_car.php & template file view_car.tpl. Loops are used when there are many rows returned, i.e If you selected all cars from the database. See the following & read the comments! view_car.php <?php include("includes/common.php"); /* select the single car that the user has clicked on */ $result = mysql_query("SELECT * FROM tab_product WHERE prod_id='".mysql_real_escape_string($_GET['id'])."'"); $thisProduct = mysql_fetch_assoc($result); /* assign the car data to the smarty variable $product */ $objSmarty->assign("product",$thisProduct); $objSmarty->assign("IncludeTemplate","view_car.tpl"); $objSmarty->display("pagetemplateautomobile.tpl") ?> view_car.tpl (this is an example. I do not know your database field names) <div> <h1>{$product.name}</h1> </div> There should be no {section} / {foreach} elements within the template. You only have 1 piece of data! Note: When you are querying the database always test your SQL either directly using the mysql command line or through a database admin tool such as phpMyAdmin. You can see the number of results that are supposed to be returned and how to handle the data.
  11. If there is an error including the template then you would see a smarty error on the screen. If not the template must be included correctly. If I were you I would view the HTML source in the browser and see what the final output is displaying. Just add some simple text to view_car.tpl like 'Hello World'. Is it in the source?
  12. Shouldn't be. Have you tested just displaying it rather than including it? <?php $objSmarty->assign("IncludeTemplate","view_car.tpl"); ?> to <?php // this is just a test $objSmarty->display("view_car.tpl"); exit(); ?> I dont think the underscore makes a difference but yoiu could try renaming the file to viewcar.tpl and change the value in the assign method. Are you including the template correctly? {include file=$IncludeTemplate}
  13. This seems to be a common issue from searching the web with no clear solution. Since recent adobe flash updates became available (I think it is 10.1), whenever I view flash video from the likes of BBC iPlayer, Seesaw (UK equiv of Hulu), Youtube, etc, after a short period of playback time, say 5 - 10 minutes the CPU usage maxes out at 100% and the playback becomes very choppy and unwatchable, also slowing this web browser down to a halt. This is not browser specific and is only a recent thing. Done all the general stuff such as re-installing flash, shockwave, etc. Installed PC cleaning software to clean the registry, get rid of junk files, fix bugs which did a good job actually, but no joy with video. Anyone else seen this? I'm guessing its adobe releasing buggy versions with a massive memory leak.
  14. Download a video player that you can embed in your HTML. They are flash themselves. I recommend Flowplayer. Read the docs to see examples of usage. http://flowplayer.org/
  15. There is not such variable as $det You have assigned $product to the template that contains the selected car record. <a href="product_img/{$product.prod_imgname1}"rel="prettyPhoto[mixed]"> You really need to learn php basics from a book. I do not think you are grasping what you are doing.
  16. <?php // find record $result = mysql_query("SELECT id FROM users WHERE name='Neil'"); // record found if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); // update existing row $result = mysql_query("UPDATE users SET name='Neil Johnson' WHERE id='".$row['id']."'"); } else { // no record found - insert a new row $result = mysql_query("INSERT INTO users SET name='Neil Johnson'"); } ?>
  17. You must have a query error. Use this to display your error and then fix it. replace <?php $result = mysql_query("SELECT * FROM tab_product WHERE id='".mysql_real_escape_string($_GET['id'])."'"); ?> with <?php if(!$result = mysql_query("SELECT * FROM tab_product WHERE id='".mysql_real_escape_string($_GET['id'])."'")) { die(mysql_error()); } ?>
  18. Post the code.
  19. You have not connected to your database on view_car.php It is best to have a common file included on all site pages that connects to your database. Then you do not have to connect to the database on each page. i.e <?php // common.inc.php mysql_connect(); mysql_select_db(); ?> <?php // preownedcars.php include('common.inc.php'); ?> <?php // view_car.php include('common.inc.php'); ?>
  20. Of course it is incorrect. The query within view_car.php should be selecting a single record (the car that the user has clicked on). You are passing the id through the URL which you use in your query. I have already posted the solution. To me you have posted the script from http://carnex.com.sg/preownedcars.php The view_car.php file should look like what I have posted.
  21. You need a SELECT prior to your INSERT / UPDATE. Run a SELECT to see if the record already exists. If it does then you perform an UPDATE query using the primary key. If it doesn't then you perform an INSERT query to add a new row. The REPLACE INTO function can be slow compared to the above.
  22. You have not posted the query on view_car.php! It should be something like <?php $result = mysql_query("SELECT * FROM tab_product WHERE id='".mysql_real_escape_string($_GET['id'])."'"); if(!mysql_num_rows($result)) { // bad id - redirect user to 404 exit(); } $thisCar = mysql_fetch_assoc($result); $objSmarty->assign("car",$thisCar); $objSmarty->display("view_car.tpl") ?>
  23. Use a CAPTCHA on your forms to prevent spam. Have a look at some of these methods to hide your email address in the page source to help prevent harvesters. http://csarven.ca/hiding-email-addresses
  24. SELECT * FROM members WHERE age='21' AND gender='male' AND height='5' etc Simple as testing what the values of the text boxes are or whether checkboxes are ticked and then build up a query similar to the above
  25. <?php $newphrase = 1234567; echo max(str_split($newphrase)); ?>
×
×
  • 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.