Jump to content

biggieuk

Members
  • Posts

    159
  • Joined

  • Last visited

Posts posted by biggieuk

  1. Hi,

     

    Thanks for your reply. Not sure that i explained myself well enough.

     

    The query needs to be run each time so that the menu can be populated, i was just hoping there was another way so that i didn't have to make a database call for every page?

     

    Could i hold the values from the db in an array and store this in a Session variable? I coould then check if the variable exists on each page and populate from this. Is that possible?

     

    Thanks again.

  2. I agree with corbin,

     

    I have had some experience with this and would advise you to steer away from holding sensitive data on your database as this can lead to all sorts of problems.

     

    Have you thought about using an established method of payment (im assuming this is what it's for) such as paypal? This removes all the worry and risk of storing credit card numbers on your database.

     

     

  3. Hi all,

     

    I have created an e-commerce website which includes a common.php file at the top of each page.

     

    This file contains the link to my mysql database, a few common functions and a query that is used to retreive a list of product categories for my navigation menu.

     

    I can't help but think there is a better way to do this so that the same query isn't run each time for each page. What would be the preferred solution here as i need to reduce loading times?

     

    thanks for any help/tips with this.

     

    Dan

  4. Thanks for your reply.

     

    I have tried everything but still can't get it to work.  ???

     

    Should function be in between my HEAD or BODY tags?

     

    I'm currently using this in the HEAD:

     

    for ( $counter = 1; $counter <= 10; $counter += 1) {
    
    mysql_select_db($database_hwbltaconf, $hwbltaconf);
    $query_colour = "SELECT * FROM colours WHERE colourid = ".$counter;	
    $colour = mysql_query($query_colour, $hwbltaconf) or die(mysql_error());	
    $row_colour = mysql_fetch_assoc($colour);
    
    $var1 = 'desc';
    $var2 = $counter;
    ${$var1.$var2} = $row_colour['colourdesc'];	
    }
    
    function checkMarker($rsval){
    
       SWITCH($rsval){
    
    
          CASE "yellow":
             echo "<img src='../images/bullets/bullet_yellow.png' title='".$desc10."' width='10' height='10' />";
             BREAK;
    
             CASE "red":
                echo "<img src='../images/bullets/bullet_red.png' title='".$desc8."' width='10' height='10' />";
                BREAK;
    
                CASE "black":
                   echo "<img src='../images/bullets/bullet_black.png' title='".$desc1."' width='10' height='10' />";
                   BREAK;
    
                   CASE "blue":
                      echo "<img src='../images/bullets/bullet_blue.png' title='".$desc2."' width='10' height='10' />";
                      BREAK;
    
                      CASE "orange":
                         echo "<img src='../images/bullets/bullet_orange.png' title='".$desc5."' width='10' height='10' />";
                         BREAK;
    
                         CASE "pink":
                            echo "<img src='../images/bullets/bullet_pink.png' title='".$desc6."' width='10' height='10' />";
                            BREAK;
    
                            CASE "purple":
                               echo "<img src='../images/bullets/bullet_purple.png' title='".$desc7."' width='10' height='10' />";
                               BREAK;
    
                               CASE "bronze":
                                  echo "<img src='../images/bullets/bullet_bronze.png' title='".$desc3."' width='10' height='10' />";
                                  BREAK;
    
                                  CASE "white":
                                     echo "<img src='../images/bullets/bullet_white.png' title='".$desc9."' width='10' height='10' />";
                                     BREAK;
    
    								 CASE "green":
    								 	echo "<img src='../images/bullets/bullet_green.png' title='".$desc4."' width='10' height='10' />";
    									BREAK;
    
                                    			 CASE " ":
    										 echo "<img src='../images/bullets/bullet_white.png' title='".$desc9."' width='10' height='10' />";
    										 DEFAULT;
    
       }
    
    }
    

     

    The $desc...  variables are all echo'ing out okay separately from the function.

     

    Here is the code in the body which should lookup the colour from the database and show the tooltip in the title:

     

    <td valign="middle"><?php checkMarker($row_sessiondetails['marker1']); ?></td>
    <td valign="middle"><?php checkMarker($row_sessiondetails['marker2']); ?></td>
    <td valign="middle"><?php checkMarker($row_sessiondetails['marker3']); ?></td>
    

     

    Thanks for help with this as im struggling  :(

     

     

  5. I think its maybe because i am using a function to get the values.

     

    Here is the full code in between my head tags:

     

    for ( $counter = 1; $counter <= 10; $counter += 1) {
    
    mysql_select_db($database_hwbltaconf, $hwbltaconf);
    $query_colour = "SELECT * FROM colours WHERE colourid = ".$counter;	
    $colour = mysql_query($query_colour, $hwbltaconf) or die(mysql_error());	
    $row_colour = mysql_fetch_assoc($colour);
    
    $var1 = 'desc';
    $var2 = $counter;
    ${$var1.$var2} = $row_colour['colourdesc'];	
    }
    
    
    
    function checkMarker($rsval){
    
    
    	if($rsval == "green"){
    
    	}else if($rsval == "yellow"){
    		echo "<img src='../images/bullets/bullet_yellow.png' title='".$desc10."' width='10' height='10' />";
    	}else if($rsval == "red"){	
    		echo "<img src='../images/bullets/bullet_red.png' title='".desc8."' width='10' height='10' />";
    	}else if($rsval == "black"){	
    		echo "<img src='../images/bullets/bullet_black.png' title='".desc1."' width='10' height='10' />";
    	}else if($rsval == "blue"){	
    		echo "<img src='../images/bullets/bullet_blue.png' title='".desc2."' width='10' height='10' />";
    	}else if($rsval == "orange"){	
    		echo "<img src='../images/bullets/bullet_orange.png' title='".desc5."' width='10' height='10' />";
    	}else if($rsval == "pink"){	
    		echo "<img src='../images/bullets/bullet_pink.png' title='".desc6."' width='10' height='10' />";
    	}else if($rsval == "purple"){	
    		echo "<img src='../images/bullets/bullet_purple.png' title='".desc7."' width='10' height='10' />";		
    	}else if($rsval == "bronze"){	
    		echo "<img src='../images/bullets/bullet_bronze.png' title='".desc3."' width='10' height='10' />";	
    	}else if($rsval == "white"){
    		echo "<img src='../images/bullets/bullet_white.png' title='".desc9."' width='10' height='10' />";
    	}else{
    		echo "<img src='../images/bullets/bullet_white.png' title='".desc9."' width='10' height='10' />";
    	}
    
    }
    

     

    And this is the code used to call the function in the body of the doc:

     

    <td valign="middle"><? checkMarker($row_sessiondetails['marker1']); ?></td>
    <td valign="middle"><? checkMarker($row_sessiondetails['marker2']); ?></td>
    <td valign="middle"><? checkMarker($row_sessiondetails['marker3']); ?></td>
    

     

    This returns a different coloured icon depending on which value is passed in with the function but the title doesn't work on hover.

     

     

    I found a different method using a CSS popup:

     

    			echo "<a href=\"#\" class=\"tt\"><img src=\"../images/bullets/bullet_green.png\" width=\"10\" height=\"10\" /><span class=\"tooltip\"><span class=\"top\"></span><span class=\"middle\">".$desc4."</span><span class=\"bottom\"></span></span></a>";

     

    which doesn't seem to work either..  :(

     

     

    any ideas?

  6. Thanks for your replies.

     

    Sorry for not being a bit more specific. I have

     

    $desc1 = $imgtitle['desc1'];
    

     

    Is what i used for the variable and has been tested and its outputting fine.

     

    I am using the echo method as its actually setting these image properties within a function. I could change this if needs be though.

     

    Not too sure why this isn't working then. I'll try another way in the morning if i cant find a solution.

     

    Thanks

  7. Hi all,

     

    Im having a little trouble finding out how to parse a variable within an echo.

     

    Here is my code:

     

    echo "<img src='../images/bullets/bullet_black.png' title='".$desc1."' width='10' height='10' />";
    

     

    Im trying to echo out $desc1 which is a value from my database.

     

    Thanks for help with this.

     

    Dan

  8. Hi all,

     

    I have created a CSS dropdown menu for my website. To space out the individual menu items i have used a top padding of 5px, however this causes the dropdown to close as the cursor hits the padding space in IE only.

     

    Is there a workaround for this?

     

    The code for the text item is:

     

    #menuh a
    	{
    	text-align: center;
    	display:block;
    	white-space:nowrap;
    	margin:0;
    	padding: 0px 0px 5px 0px; /* height of menu */
    	}
    

     

    thanks for hel with this.

     

    Dan

  9. Hi all,

     

    Im having a bit of trouble finding a solution as to how i can export a list of results to a .csv file. These results are returned from the database using the following two sql statements:

     

    // To return a list of users that have the $groupid value in one of thier selections, selections are stored like (12,16,22,55)
    
    "SELECT users.username FROM users WHERE users.selections REGEXP '[[:<:]]".$groupid."[[:>:]]'"
    
    //At the top of the excel file there should be the name of the session, time & venue using this sql
    
    "SELECT sessions.group,title,room,time FROM sessions WHERE groupid = ".$groupid"
    
    

     

    Any advice would be great. I have tried editing an existing csv file but can only get it to return the list of users.

     

    <?php require_once('../Connections/hwbltaconf.php'); 
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=SessionUsers.csv");
    header("Pragma: no-cache");
    header("Expires: 0");
    
    
    mysql_select_db($database_hwbltaconf, $hwbltaconf);
    $query = "SELECT users.username FROM users WHERE users.selections REGEXP '[[:<:]]11[[:>:]]'";
    $exp = mysql_query($query);
    $count = mysql_num_fields($exp);
    for ($i = 0; $i < $count; $i++) {
    $header .= mysql_field_name($exp, $i).",";
    }
    while($row = mysql_fetch_row($exp)) {
    $line = '';
    foreach($row as $value) {
    if ((!isset($value)) OR ($value == "")) {
    $value = "\t";
    } else {
    $value = str_replace('"', '""', $value);
    $value = '"' . $value . '"' . ",";
    }
    $line .= $value;
    }
    $data .= trim($line)."\n";
    }
    $data = str_replace("\r", "", $data);
    if ($data == "") {
    $data = "\n(0) Records Found!\n";
    }
    print "$header\n$data";
    exit;
    
    ?> 
    

     

    Thanks

  10. Hi all,

     

    I have a little question about styling quotes on my website.

     

    I want to display a left quote image, then the quote text in the middle and a right quote image on the end.

     

    I currently have this like so:

     

    #quotel{  background:url(../images/content/quote-left.gif) no-repeat; height:32px; width:42px; float:left; }
    #quoter{  background:url(../images/content/quote-right.gif) no-repeat; height:32px; width:42px; float:right; }
    

     

    The right qutoe image is displayed slightly offline though.

     

    Is there a way i can make this into a single class so that i can insert into a <p> tag?

     

    thanks very much!

  11. Im not looking for this to be done for me, i am basically looking for advice on how to do this.

     

    here is my current attempt:

     

    box2.jpg

     

    the Red & blue slices are CSS fills with either a border-top or border-bottom.

     

    My HTML is:

     

    <div id="box1">
    <div id="box1-topleft"></div><div id="box1-topmiddle"></div><div id="box1-topright"></div>
    <div id="box1-left"></div><div id="box1-middle"></div><div id="box1-right"></div>						
    </div>
    

     

    I have floated topleft,topmiddle,topright to the left and thats looks fine. I cannot seem to get the bottom half to line up though.

     

     

     

     

  12. Hi all,

     

    Im having a problem with my mod_rewrite after installing wordpress onto my server.

     

    I receive a 404 error when trying to directly access the wordpress folder :  www.mysite.com/blog

     

    here is my .htaccess contents:

     

    <IfModule mod_rewrite.c>
    
    RewriteEngine on
    Rewritecond %{HTTP_HOST} !^www\.mysite\.com
    RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
    
    RewriteRule ^products/([0-9]+)(/.*)?$  /products.php?id=$1 [L]
    RewriteRule ^item/([0-9]+)(/.*)?$  /item.php?id=$1 [L]
    
    RewriteRule ^()$ index.php [NC,L]
    Rewritecond %{REQUEST_URI} !(^/?.*\..*$) [NC]
    RewriteRule (.*)$ $1.php [NC]
    
    ErrorDocument 404 /404.php
    
    </IfModule>
    

     

    Thanks for help with this!

     

    Danny.

  13. Thanks for your replies.

     

    I tried the following but my database is not updating. Can you spot any errors?

     

    p.s. 'db/conn.php' is used to setup the connection and works with other pages.

     

    <?php require_once('db/conn.php'); ?>
    <?php
    
    $arr = array("016B","025B","052B","064B","064P","066B","067B","067P","3MTM","ABFB","AKDB","AKFB","ALCB","ALFB","ALFP","ALGB","ALMB","ALMP","ALNB","ALSB","ALTB","AMQB","AMSR","APSB","ARSB","BASB","BCSB");
    
    foreach ($arr as $value) {
    
    $query_sections = "SELECT * FROM tblsubsections WHERE imgsrc LIKE '%{$value}%' ";
    $sections = mysql_query($query_sections, $promo) or die(mysql_error());
    $row_sections = mysql_fetch_assoc($sections);
    
    
    //update data into imgsrc
    $query_section = "UPDATE tblsubsections SET printareaimgsrc = '/images/printarea/{$value}.jpg' WHERE subsectionid = '{$row_sections['subsectionid']}'";
        mysql_query($query_section, $promo) or die(mysql_error());	
    
    }
    
    ?>
    

     

    Any ideas?

  14. Hi all,

     

    Im trying to get this query working but im not sure if the syntax is correct:

     

    $query_sections = "SELECT * FROM tblsubsections WHERE imgsrc LIKE '%'".$value."'%'";
    $sections = mysql_query($query_sections, $promo) or die(mysql_error());
    $row_sections = mysql_fetch_assoc($sections);
    
    
    //update data into imgsrc
    $query_section = "UPDATE tblsubsections SET printareaimgsrc = '/images/printarea/'".$value."'.jpg' WHERE subsectionid = '".$row_sections['subsectionid']."'";
    mysql_query($query_section, $promo) or die(mysql_error());
    

     

    Could someone please tell me how to pass a variable into the query string with a fixed value infront of it?

     

    thanks

  15. Hi all,

     

    I am trying to implement the menu found at CSS Play: http://www.cssplay.co.uk/menus/basic_dd.html

     

    I have a layout which is centered but when i put a container around the menu and set the margins to auto it doesn't centre the menu.

     

    Here is the CSS code from the menu:

     

    .menu ul{ list-style-type:none; padding:0; }
    
    .menu li{ float:left; position:relative; z-index:100; }
    
    .menu table{ position:absolute; border-collapse:collapse; z-index:80; left:-1px; top:25px; }
    
    .menu a, .menu :visited { display:block; font-size:10px; width:120px; padding:7px 0; color:#000; background:#A5D2EB; text-decoration:none; margin-right:1px; text-align:center;}
    
    .menu :hover{ color:#444; background:#5596E6; }
    
    .menu ul ul { visibility:hidden; position:absolute; width:120px; height:0; }
    
    .menu ul li:hover ul,
    .menu ul a:hover ul{
    visibility:visible;
    }
    
    #divMenuContainer { width:100%; margin-left:auto; margin-right:auto; height:100%}
    

     

    I would really appreciate any help with this.

     

    Thanks

  16. Hi,

     

    Im looking for some help with a query im trying to do.

     

    I have 2 tables:

     

    tblsections

     

    sectionid  |  name

    ------------|------------------

          1        |    Gifts

     

    tblsubsections

     

    subsectionid  |  sectionid

    ----------------|----------------

            12        |        1

     

     

    Using the subsectionid i am trying to write a query that retrieves the name value from tblsections.

     

    Thanks for any help with this.

     

    Dan

  17. Hi,

     

    Not too sure if this is the right forum section but here goes..

     

    I am looking for some website structure tips for my first basic online shop & admin backend.

     

    The admin section will allow the user to add/remove/edit Main menu items, Add new product groups & products etc....  No payment functionality will be needed only a cart to store the selected products so sales know which order num to refer to.

     

    What would be the preferred method, having one page for each area of the site and have it dynamically populated for the different products/sections?

     

    I am also wanting to use .htaccess to create friendly URLS and for SEO reasons.

     

    Any tips are appreciated as i have never developed a shop website before.

     

    Thank you!

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