Jump to content

n3ightjay

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Posts posted by n3ightjay

  1. you have to remember to enQuote your string/charactor values with quotes and leave you numeric values open

     

    <?php
    $qry="insert into cart_table(product_id,image,product_name,quantity,price,shipping_cost,total_cost) values(".$id.",'".$row['image']."','".$row['product_name']."',1,".$row['price'].",".$row['shipping_cost'].",".$row['price']."+".$row['shipping_cost'].")";
    ?>
    

     

    i think thats it im not sure of your db structure though also if your hardcoding your quantity value don't quote it out

  2. isset() is not the same as !empty().  Since he has $cat = $_POST['category';, it'll be set no matter what.  Example:

     

    <?php
    $foo = '';
    var_dump(isset($foo));
    

     

    Outputs:

    bool(true)

     

    Good point got excited in trying to find multiple ways of answer the same question... assumed checking against zero was checking if it was empty ... therefore leading me down the path to isset()

  3. I would use ternary "ifs"

     

    <div id="navigation">
    <div id="maintabs">
    	<a href="#"<?=($tabParam == "home"?" selected":"");?>><span>Home</span></a>
    	<a href="#"<?=($tabParam == "reports"?" selected":"");?>><span>Reports</span></a>
    	<a href="#"<?=($tabParam == "administration"?" selected":"");?>><span>Administration</span></a>
    	<a href="#"<?=($tabParam == "logOut"?" selected":"");?>><span>Log Out</span></a>
    </div>
    <div id="subnav">
    	<a href="#"<?=($tabSubNav == "subNav1"?" selected":"");?>>Sub Nav Item #1 For Home</a>
    	<a href="#"<?=($tabSubNav == "subNav2"?" selected":"");?>>Sub Nav Item #2 For Home</a>
    	<a href="#"<?=($tabSubNav == "subNav3"?" selected":"");?>>Sub Nav Item #3 For Home</a>
    	<a href="#"<?=($tabSubNav == "subNav4"?" selected":"");?>>Sub Nav Item #4 For Home</a>
    </div>
    </div>
    

  4. for loop would be the easiest then you already have a counter going but you could create a counter for a while loop.. sorry you'll have to figure out which of the following work better for you im to lazy to look through your code to figure out where / what your talking about

     

    $counter = 0;
    while(true){
      if($counter % 2 == 0){
        $class = "class1";
      }else{
        $class = "class2";
      }
      $counter++;
    }
    

     

    or

     

    for($i = 0;$i <= $whatever;$i++){
      if($counter % 2 == 0){
        $class = "class1";
      }else{
        $class = "class2";
      }
    }
    

  5. You 3rd if is comparing incomparable types (I don't know if thats the actuall definition of the solution but this works i tested it) ??? if you change it to

    if($cat != ""){
    

    or

    if($cat != "0"){
    

     

    it will work

  6. I know you clicked solved but i just had to finish this ... this will work for any matix setup in the layout order you wanted:

     

    <table>
    <?php
    $result = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
    $numRows = 5;
    $numCols = 3;
    for($i = 0; $i < $numRows; $i++){
    echo "<tr>";
    for($j = 0;$j < $numCols; $j++){
    	echo "<td>" . $result[($j*$numRows)+$i] . "</td>";
    }
    echo "</tr>";
    }
    ?>
    </table>
    

  7. I created some logic while you posted your solution:

    your current display logic:

    <table>
    <?
    $result = array(1,2,3,4,5,6,7,8,9);
    for($i = 0; $i < 3; $i++){
    echo "<tr>";
    for($j = 0;$j < 3; $j++){
    	echo "<td>" . $result[($i*3)+$j] . "</td>";
    }
    echo "</tr>";
    }
    ?>
    </table>
    

     

    logic to switch:

     

    <table>
    <?
    $result = array(1,2,3,4,5,6,7,8,9);
    for($i = 0; $i < 3; $i++){
    echo "<tr>";
    for($j = 0;$j < 3; $j++){
    	echo "<td>" . $result[($j*3)+$i] . "</td>";
    }
    echo "</tr>";
    }
    ?>
    </table>
    

     

    this is assuming you always have a 3x3 grid though i hope this helps

  8. echo "<td bgcolor=".$rowcolor." style=\"padding-left:5px\" class='normal'><a href=javascript:createplayer(/'".$rfiles['vidlink']."') >".$rfiles['vidname']."</a></td></tr>";

     

    looks like you have you apostophies messed up in "...createplayer(/'".$ ..... " switch it to "...createplayer('/".$ ...."

    ie:

    echo "<td bgcolor=".$rowcolor." style=\"padding-left:5px\" class='normal'><a href=javascript:createplayer('/".$rfiles['vidlink']."') >".$rfiles['vidname']."</a></td></tr>";
    

     

    I hope this is fixes it .. a good check when something like this happens is to view the source to make sure the echo'd php is matching up you JS / HTML code

  9. 2 trains of thought for ya... First is start with MySQL joins ... a quick google search says that 'left join' can combine multiple tables .. but i can't think of how to maintain the id.

     

    the second would be 4 seperate querys for each query and just limiting the results to keep the page size small ... this would definately make maintaining the ids easier

  10. <?php if ($row_pagecontent['subid'] != '5' || ($row_pagecontent['subid'] != '5' && mysql_num_rows($extras) > 0)): ?>
    

     

    the div will always show if the pagecontent.subid != 5 because of the or(||) operator you will always have a logical truth.

     

    try this:

     

    <?php if ($row_pagecontent['subid'] != '5' && mysql_num_rows($extras) > 0): ?>
    

  11. Instead of pulling in content based on a PHP ID variable, is it possible to pull in content based on the TLD (such as 'www.clientswebsite.com')

     

    So, if URL equals 'clientswebsite.com', then insert 'this file or image'.  If URL equals 'anotherclientwebsite.com', then insert 'this file or image' instead.

     

    Yes it is : (definately not using cookies) something like:

     

    <?
    
    if('$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"' == "www.clientswebsite.com"){
    	include(whatever);
    }elseif('$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"' == "www.anotherclientwebsite.com"){
    	include(whateverElse);
    }
    
    ?>
    

  12. you have to take a field that is manditory ... like their name (if your not entering that) and check to make sure its not null then proceed for my example im assuming they have to enter their own first name:

    this would go directly after you start your while loop

     

    if($row['first'] != ""){
    ?>
    ** Your Form with info in it **
    <?
    }else{
    ?>
    ** Your blank form **
    <?
    }
    ?>
    

  13. If i understand you correctly you don't need arrays at all ... you could simply

    write the script to insert the info 'weekly_hits' as the query executes ie:

    $query = mysql_query(your count query);
    while($hits = mysql_fetch_row($query)){
    mysql_query(your insert query)
    }
    

     

    but since you asked about arrays one way to do it would be (but this is a serious memory hog)

    is

     

    arrayVar[sid] = hits;

     

    ie.

    arrayVar[12] = 13;

    arrayVar[21] = 61;

     

    but there this creates a large essentially empty array unless your sid's are closer in frequency IE sid 1 sid 2 sid 3

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