Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by sasa

  1. in line 21 define new variable for checkin is form valid

    <?php include("include/left_bar.php"); $chk = TRUE; ?>
    

    in line 27 - 28 add

    <?php if (isset($_POST["submit"])&&(empty($fname)))
    { echo"<center><em><div id='form'>Please Your Frist Name Is Required<br></div></em></center>"; $chk = FALSE;}?>
    

    same for another fields

    and in line 21 of 2nd file add

    if($chk) $submit=mysql_query("INSERT  INTO users(fname,lname,username,email,password,phone,gender)VALUES('$fname','$lname','$username','$email','$password','$phone','$gender')") or die("REGISTRATION NOT COMPLETED Thanks");
    
  2. move submit line inside form and close form tag

    somet6hing like this

    {
      	 echo "<tr>";
      	  echo "<td align='center' width=40>". $row['Art']. "</td>";
      	   echo "<td align='center' width=80>". $row['d']. "</td>";
      	   echo "<td align='center' width=80>". $row['De']. "</td>";
      	   echo "<td align='center' width=80>". $row['Lo']. "</td>";
      	   echo "<td align='center' width=80>". $row['R']. "</td>";
      	   echo "<td align='center' width=80>". $row['nt']. "</td>";
      	   echo "<td align='center' width=80>". $row['Ln']. "</td>";
     	   echo "<td align='center' width=80>". $row['sn']. "</td>";
     	   echo "<td align='center' width=80>". $row['Fn']. "</td>";
     	   echo "<td align='center' width=80>". $row['rdj']. "</td>";
     	   echo "<td align='center' width=80>". $row['stanje']. "</td>";
     	   echo "<td align='center' width=80>". $row['cena']. "</td>";
     	   echo "<td align='center' width=80>". $row['artnr']. "</td>"; 
           // echo '<td><button type="submit" src="shopping-cart-icon-614x460.png" width="30" height="30" id="btn_9" class="Button3" ></button></div>
    
     <form id="form_'.$row["artnr"] .'" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_self" 
     
     style="margin:0;position:absolute;left:279px;top:1146px;width:220px;height:96px;">
     <input type="hidden" name="bn" value="shoping.cart">
     <input type="hidden" name="cmd" value="_cart">
     <input type="hidden" name="business" value="feder-matic@europe.com">
     <input type="hidden" name="item_name" value="Druckfedern">
     <input type="hidden" name="item_number" value="' . $row["artnr"] . '">
     <input type="hidden" name="currency_code" value="EUR">
     <input type="hidden" name="amount" value="1.00">
     <input type="hidden" name="add" value="1">
     <input type="hidden" name="quantity" value="1">
     <input type="hidden" name="no_shipping" value="0">
     <input type="hidden" name="no_note" value="1">';
     echo '<td><button type="submit" src="shopping-cart-icon-614x460.png" width="30" height="30" id="btn_9" class="Button3" ></button>';
    echo '</form>';
     	  echo "</tr>";
       }
        echo "</table>";
             }
     
     mysql_close($db_con);
     ?>
    

    i change form id to. it's must bi uniq

  3. He

    You don't count how many record is echoed.

    Put counter to zero before while loop

    incrise counter in loop (just in start of it)

    This counter compare with $maxCount

    in second if statement return counter to zero

    if ($productCount > 0) {
    $cnt = 0;
    while($row = mysql_fetch_array($sql4)){
    $cnt++; 
                 $id = $row["id"];
    $product_name = $row["product_name"];
    $price = $row["price"];
    $category = $row["category"];
    $details = $row['details'];
    $date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
    
    $maxCount = 5;
    
    if ($cnt != $maxCount) {
    
     $dynamicList .= '<td width="150"><a href="inventory_images/'.$id.'.jpg" target="_blank"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '_small.jpg" alt="' . $product_name . '" border="1" width="150"/></a> '.$details.'£'.$price.' <form id="form1" name="form1" method="post" action="cart.php"><input type="hidden" name="pid" id="pid" value='.$id.' /><input type="submit" value="" name="button" id="button" class="cardbutton" /></form></td>'; 
    }
    
    else if ($cnt == $maxCount) {
    $cnt = 0;
     $dynamicList .= '<td width="150"><a href="inventory_images/'.$id.'.jpg" target="_blank"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '_small.jpg" alt="' . $product_name . '" border="1" width="150"/></a> '.$details.'£'.$price.' <form id="form1" name="form1" method="post" action="cart.php"><input type="hidden" name="pid" id="pid" value='.$id.' /><input type="submit" value="" name="button" id="button" class="cardbutton" /></form></td></tr><tr>'; }
    
  4. He

    change name of variable $res in this part of code

    while ($rows=mysql_fetch_assoc($res)) {
      
        
        $sql = "UPDATE spammers 
          SET abc='". 5252 ."'
          WHERE spamID ='".$rows['spamID']."';";
        $res = mysql_query($sql); // change to something diferent
        if(!$res) { // and in this line 
         die(" Could not query the database: <br/>". mysql_error() );
        }
    
  5. he

    in your code try to replace

       if($page+4 >= $pages) $pagex=$pages;
       else $pagex = (($page != 5) ? $page+4 : $page+1);
       echo $page-4;
       for($i=$page-4 ; $i<=$pagex ; $i++) {
    

    with

       if($page+2 >= $pages) $pagex=$pages; else $pagex = $page+2);
       if($page > $pagex - 2) $pagein = $pagex - 4; else $pagein = $page - 2;
       if($pagein < 1) $pagein = 1;
       for($i = $pagein; $i <= $pagex; $i++) {
    
  6. Pika, you may be interested to learn that the && can be used as a quick shorthand IF:

     

    strpos($off, ';') !== FALSE && $off = substr( $off, strpos( $off, ";" ) + 1 );

    It's sloppy and perl-like and will cause any code reviewers to punch you, but it's valid.  I think it's fun.

     

    you can use or too
    strpos($off, ';') == FALSE || $off = substr( $off, strpos( $off, ";" ) + 1 );

  7. try

    <?php
    include_once "connect_to_mysql.php";
    $cols = 3;
    $result = mysql_query("SELECT plantID, botanicalName FROM plants ORDER BY botanicalName");
    $numrows = mysql_num_rows($result);
    $rows_per_col = ceil($numrows / $cols);
    
    $c = 1;
    $r = 1;
    
    while ($row = mysql_fetch_array($result)) {
    $plantID[$r][$c] = $row["plantID"];
    $botanicalName[$r][$c] = $row["botanicalName"];
    
    if ($r == $rows_per_col) {
    	$c++;
    	$r = 1;
    } else {
    	$r++;	
    }
    }
    $dyn_table = '<table width="750" cellpadding="0" cellspacing="0" border="0">';
    for ($r = 1; $r <= $rows_per_col; $r++) {
    $dyn_table .= '<tr>';
    
    for ($c = 1; $c <= $cols; $c++) {
    	$dyn_table .= '<td><a href="plant_details.php?plantID = ' . $plantID[$r][$c] . '" id="plantLink">' .  $botanicalName[$r][$c] . '</a></td>';
    }
    $dyn_table .= '</tr>';
    }
    $dyn_table .= '</table>';
    ?>

  8. I don't think there is a function for that, but a simple while loop will solve that for you.

     

    <?php
    $level = 1;
    $cost = 10;
    $money = 100;
    while($money > $cost)
       {
           $money -= $cost; //remove cost from money left
           $cost += 5; //increase base cost
           ++$level; //increment your level
       }
    echo $level;

     

    That will output 5 levels for 100 bucks.

     

    Edit:: Removed a pointless step.

    if you chane many to 90 that will output 5 levels for 90 bucks.
×
×
  • 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.