Jump to content

melting_dog

Members
  • Posts

    118
  • Joined

  • Last visited

    Never

Posts posted by melting_dog

  1. Hi guys,

     

    I have a simple INSERT code. It does not throw any errors and all seems ok but the data is just not appearing in the DB. I've spent ages looking over it but perhaps a 2nd set of eyes could help?

     

    Thanks!

     

    	$con = mysql_connect("localhost","posturep","");
    
    	$tablename = 'product';
    
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    	  
            //Form data sent
    
    	$product_name = $_POST['product_name'];  
    	$product_active = $_POST['product_active'];  
    	$product_cat = $_POST['product_cat'];  
    	$product_desc = $_POST['product_desc'];  
    	$prod_inoutdoor = $_POST['prod_inoutdoor']; 
    	$prod_stackable = $_POST['prod_stackable']; 
    	$prod_discounted = $_POST['prod_discounted'];  
    
    	echo $product_name;
    
    	$sql = "INSERT INTO $tablename (name) VALUES ($product_name)";
    
    	mysql_query($sql);		
    			echo "<p>Product Saved!</p>";
    			echo $sql;	
    	mysql_close($con);

  2. Hi guys,

     

    Thanks for the response (this forum is so much better to get answers from then the actual WP forum). After a bit of scrounging around I have found the issue. In WP plugins you cannot have a closing php tag ?> at the end of your script.

     

    As the file is 'php_included' into WPs own PHP, having the closing tag rendered all the script appearing below the plugin invalid.

     

    Cheers for the help!

  3. Hi All

     

    I am trying to create my first Wordpress plugin. So far it actually works fine but for one error:

     

    I get a 'Headers Already Sent' PHP message when I try to login to wp-admin.

     

    If I remove the plugin file from the wpcontent/plugins directory, login as usual, then replace the plugin file it works fine - this just seems to occur with login in and out.

     

    My (abridged) code is:

     

    <?php
    /*
    Plugin Name: Product Manager
    Plugin URI: http://www.tech-knowledge.com.au
    Description: Add, edit and remove products
    Version: 1.0
    Author: Me
    Author URI: http://www.tech-knowledge.com.au
    License: Restricted
    */
    
    if ( is_admin() ){
    /* Call the html code */
    add_action('admin_menu', 'prodmanager_admin_menu');
    
    function prodmanager_admin_menu() {
    add_options_page('Product Manager', 'Product Manager', 'administrator',
    'product-manager', 'prodmanager_html_page');
    }
    }
    
    function prodmanager_html_page() {
    ?>
    
    <div>
    
    <h2>Product Manager</h2>
    <!--usual HTML and PHP Code--> 
    </div>
    ?>
    

    Let me know if you would like to see it all.

     

    Any advice would be really, really appreciated!

     

    Thanks!

  4. Hi all,

     

    I am building an image slider with a timer. I have everything working except for the mechanism that makes the slider go back to the start when it reaches the end. I am sure I will figure that out but there is an IF statement thats giving me trouble.

     

    Basically its meant to reset i and show the alert box IF i (the counter) is equal to the number of images (so i gets +1 for each image it shown). Troulble is its just not triggering. I just cant figure out why. Can anyone help?

     

     

    Code is:

     

    var totalImages = jQuery("#gallery > li").length,

    imageWidth = jQuery("#gallery > li:first").outerWidth(true),

    i = 1;

     

    while(i < totalImages){  

                    jQuery("#gallery").delay(4000).animate({left : "-=" + imageWidth + "px"});

     

    if(i == totalImages){

    alert('The End');

    i = 1;

    }

    i++;

    }

     

     

    Thanks!

     

  5. Hi all,

     

    Sorry: I hope this is the correct forum for this question.

     

    I have a directory within my public_html directory that contains a newer version of my site. Rather then deleting the old site in public_html I am hoping to just redirect all www requests to the new directory.

     

    I have tried to google how to do this but havent come up with anything useful asides from editing the .htacess file with: Redirect /index.html http://example.com/newdirectory/

     

    but I am not sure this will work. I do not want my URLs to consistently appear like www.mysite.com/newsite

     

    Can anyone advise me?

     

    Thanks

  6. Hi all,

     

    I have a site that displays a product, then shows similar products based off the name of the first (like a 'You might also like...' list). However the original product keeps appearing in this similar product list. I need a way to exclude that product.

     

    You can see this here:

     

    http://adamsherman.com.au/postureperfection/product-page/?prodid=3

     

    Notice how the Reno Stool also appears in the suggested items list.

     

    Can anyone help me out? Heres the SQL:

     

    $sql = "SELECT * FROM product WHERE " . implode(' OR ', $searchTerms) . " AND product_id != '$prodid' LIMIT 3";

     

    The .implode() just splits up the name of the item whilst $prodid is the items unique identifier. I have also tried NOT LIKE, <> and != $productname as well.

     

    Any help would be much appreciated. Thanks!

  7. I'd say this is a Javascript question. The best you could do in HTML/CSS would be to hard code those boxes which would kind of defeat the purpose of allowing the user to upload images of any size or create a fluid system with all images within a div of certain width floating left. It will look messy but might be a start.

     

    CSS:

     

    #imagewrapper {

    width: 800px;

    overflow: auto;

    }

     

    .image {

    float:left;

    }

     

    There may be a JQuery plugin that could help as well. Check here for some examples: http://www.1stwebdesigner.com/css/fresh-jquery-image-gallery-display-solutions/

  8. Hi all,

     

    I am trying to add a series of custom menus to my Wordpress theme but they all return the same menu.

     

    I have this in my functions.php

     

    add_action('init', 'register_custom_menu');

    function register_custom_menu() {

    register_nav_menu('custom_menu', __('Custom Menu'));

    register_nav_menu('specials_menu', __('Specials Menu'));

    }

     

    and this in the nav section of my header:

     

    <?php wp_nav_menu(array('menu' => 'specials_menu')); ?>

    <?php wp_nav_menu(array('menu' => 'custom_menu')); ?>

     

    Can anyone tell me where I've gone wrong? I thought this was the way it was meant to work

     

  9. Hi tomhatten,

     

    Sorry I might need a little more information but from what I understand you simply want to place a link to their site somewhere in your content?

     

    The HTML tag to do that is the 'a' tag and it would look like this:

     

    <a href="www.theirwebsite.com" target="_blank">Click here to go to this website!</a>

     

    The 'target="_blank"' part is not necessary but it will open their website in another tab rather then over your site.

     

    Hope that helps!

  10. Hi all,

     

    I have a design that calls for me to list all the items - image thumbnails in this case -  that I retrieve from the database into 3 columns.

     

    I can achieve that using float: left; but that makes putting anything below the list difficult. I need a better way of doing it.

     

    My site is here: http://adamsherman.com.au/postureperfection/chairs/ (please note it is under construction!!)

     

    and here is the css:

     

    .productthumb{

    padding: 10px;

    margin: 10px;

    width: 170px;

    height: 190px;

    float:left;

    text-align:center;

    }

     

    Should I be using <ul> and <li> instead of individual divs?

     

    Any help would be appreciated! Thanks!

  11. Hey guys,

     

    Was wondering if someone could point me on the right path here. I am able to get the page URL using:

     

    $url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

     

    But was wondering if there was a way to drop the PHP variables attached to the URL.

     

    e.g.

     

    mysite.com/catalogue/?item=23

     

    becomes

     

    mysite.com/catalogue/

     

    Can anyone help me out?

     

    Thanks!

  12. Hi guys,

     

    I know this is a Wordpress question by I am really hoping I can get a hand here (the WP forums are pretty useless).

     

    I have created a custom form with this:

     

    <form action="http://www.adamsherman.com.au/postureperfection/thankyou" method="post">

     

    When I hit the submit button on the form, however, it just gives me a 404.

     

    BUT, if I copy and paste the above URL into my browser it works fine (I.E. takes me to the thankyou page that mails the form info).

     

    Heres the contact page if you want a go:

    http://adamsherman.com.au/postureperfection/product-inquiry/?prodid=323

     

    Would anyone know whats going on here?

     

    Thanks!

     

     

  13. Haha thanks PFMaBiSmAd!

     

    I came to the same conclusion too! and thats what I am running with:

     

    echo '<span class="productdescription">'. nl2br($row['description']).'</span>';

     

    This works absolutely fine!

     

    I was initially looking at explode() as I wanted to loop the strings through a <ul> but this will do nicely

×
×
  • 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.