Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Posts posted by techker

  1. hey thanks dude i just got to debug it..the select box part works fine but the las part

     

    <?php

    if(!empty($username))

    {

        $q = mysql_query("SELECT * FROM `authuser` WHERE `username`='".$username."'")

        $r = mysql_fetch_array($q);

        echo $r['username'];

        //rest of your user data....

    }

    ?>

     

    gives me errors

     

     

  2. hey guys i got to the part were it populates my select box.but  i need to echo what i select?

     

    <?
    // Connect database
    mysql_connect("localhost","techker_","o");
    mysql_select_db("o_test");
    ?>
    <select name="categoryID">
    <?
    $sql = "SELECT name FROM authuser ".
    "ORDER BY name";
    
    $rs = mysql_query($sql);
    
    while($row = mysql_fetch_array($rs))
    {
      echo "<option value=\"".$row['name']."\">".$row['name']."\n  ";
    }
    ?>
    </select>
    

  3. hey guys my query works fine like this

     

    $q = "SELECT * FROM events";
    $res = mysql_query($q);
    $row = mysql_fetch_assoc($res);
    echo (empty($row['d'])? "empty": "not empty"); 
    

     

    now when i add a link to a page that will show the description in deatails i add

     

    $id=$_POST['id'];
    $q= "SELECT * FROM events WHERE id = ".$_GET['id']."
    LIMIT 1 ,30 ";
    $res= mysql_query($q);
    $row= mysql_fetch_assoc($res);
    

     

    the get it..it give my empty all the time?

     

  4. hey guy i have this script that inputs in a db how many times you done this week..

     

    so i made a page that views the hours and i would like to but an if in every query that if there is nothing in the db output OFF

     

    this is my query

     

    $query3 = "SELECT COUNT(*) AS TotalCount, `to_t2` - `from_t2` AS TotalNumber, SUM( `to_t2` - `from_t2`) AS Totalhours FROM `week2`GROUP BY `from_t2` ";
    $result3 = mysql_query($query3) or die(mysql_error());
    

     

    can i add an order by even if there is a group by?

  5. hey guys im doing a car dealer site for my budy and im trying to figure out a page to show multible cars inventory page..

     

    i got this going but it is now showing the second query right?

    <?php 
    $QQQ = mysql_query("SELECT * FROM employees"); 
                                             
                                             
    if (!$QQQ) die(mysql_error());   
    // Get the total number of rows 
    $total_items = mysql_num_rows($QQQ); 
                                             
    // Get the page limit & page 
    $limit        = $_GET['limit']; 
    $page        = $_GET['page']; 
                                             
    // Do default setting 
    if((!$limit)  || (is_numeric($limit) == false) || ($limit < 1) || ($limit > 5)) { 
    $limit = 2; //default 
                                            }  
                                             
    // Do default setting 
    if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) { 
    $page = 1; //default 
                                            }  
                                             
    // Calculate the number to page to display 
    $total_pages     = ceil($total_items / $limit); 
    $set_limit     = $page * $limit - ($limit); 
    
    $QQQ1 = mysql_query("SELECT * FROM employees LIMIT $set_limit, $limit "); 
    if(!$QQQ1) die(mysql_error()); 
    $err = mysql_num_rows($QQQ1); 
    if($err == 0) die("No matches met your criteria."); 
    
                                             
    // Let user decide how many result to show in each page 
    // echo "Results per page:  "; 
    //echo "<a href='list_store.php?limit=2&page=1'>2</a> |  
    //<a href='list_store.php?limit=5&page=1'>5</a> |  
    //<a href='list_store.php?limit=10&page=1'>10</a>"; 
                                             
    //Count Message 
    $count = 1; 
                                             
    //to loop the results into the table rows code goes here 
    //while($FFF = mysql_fetch_assoc($QQQ1)) { 
    ?> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>Untitled Document</title> 
    <style type="text/css"> 
    <!-- 
    body { 
        background-image: url(images/index_23.gif); 
    } 
    --> 
    </style></head> 
    
    <body> 
    <table width="515" height="346" border="0" align="center" cellpadding="0" cellspacing="0"> 
      <tr> 
        <td width="515" height="346" valign="top" background="images/admin_mid_m.jpg"><table width="506" height="140" border="1" align="center" cellpadding="0" cellspacing="0"> 
           
            <tr><?php while ($info=mysql_fetch_array($QQQ1)) {?> 
                    <td width="209" height="105" rowspan="6"><div align="center"><?php echo '<img src="/ADMIN/pics/'. $info['thumb'] .'" border="0" alt="" /> 
    <br />'; ?></div></td> 
                  </tr> 
                  <tr> 
                    <td colspan="2"><div align="center"><?php echo $info['name'] ?>-<?php echo $info['email'] ?></div></td> 
                    <td> </td> 
                  </tr> 
                  <tr> 
                    <td height="23" colspan="2"><strong>Numero de commande:<?php echo $info['numero'] ?></strong></td> 
                    <td width="87"> </td> 
                  </tr> 
                  <tr> 
                    <td height="60" colspan="2"><?php echo $info['description'] ?></td> 
                    <td> </td> 
                  </tr> 
                  <tr> 
                    <td height="29" colspan="2"><strong>Sold </strong>:<?php echo $info['sold'] ?></td> 
                    <td height="29"> </td> 
                  </tr> 
                  <?php } ?> 
          </table> 
          <p><table width="194" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> 
       <tr> 
         <td width="194"><div align="center">  
           <?php  
                                             
    $prev_page = $page - 1; 
                 
    if($prev_page >= 1) {  
    echo(" <a href=index_view.php?limit=$limit&page=$prev_page><b>Prev</b></a>");  
    }  
                                             
    for($i = 1; $i <= $total_pages; $i++){ 
    if($i == $page){ 
    echo($i." "); 
    }else{ 
    echo("<a href=\"index_view.php?limit=$limit&page=$i\">$i</a> "); 
    } 
    }  
                 
    $next_page = $page + 1; 
    if($next_page <= $total_pages) { 
    echo("</b><a href=index_view.php?limit=$limit&page=$next_page><b>Next</b></a> ");  
                                            }  
                 
    //dbDisconnect($conn2); 
    ?></td> 
            </tr> 
        </table></p></td> 
      </tr> 
    </table> 
    </body> 
    </html> 
    
    

     

    this is whats it showing.

    http://www.canada-auto.com/new/inv_inc.php

     

  6. ok small question for me to understand once and for all!lolsorry

     

    that querry is in the top of my page.now in my page were the echo is i put this

    <?  while($row = mysql_fetch_array($result9)) {?>
    
    <? echo $row['Totalhours'] ." H"; ?>
    
    <? }?>
    
    now do i put that if there?
    <?  while($row = mysql_fetch_array($result9)) {?>
    
    if (mysql_affected_rows == 0) {
    echo "Off";
    } else {
    <? echo $row['Totalhours'] ." H"; ?>
    }
    

     

     

  7. well ok..

     

    my querry:

    $query9 = "SELECT COUNT(*) AS TotalCount, `to_t1` - `from_t1` + `to_t2` - `from_t2`+ `to_t3` - `from_t3`+ `to_t4` - `from_t4`+ `to_t5` - `from_t5`+`to_t6` - `from_t6`+ `to_t7` - `from_t7` AS TotalNumber, SUM( `to_t1` - `from_t1` + `to_t2` - `from_t2`+ `to_t3` - `from_t3`+ `to_t4` - `from_t4`+ `to_t5` - `from_t5`+`to_t6` - `from_t6`+ `to_t7` - `from_t7`) AS Totalhours FROM `week1`GROUP BY `from_t1` "; 
    $result9 = mysql_query($query9) or die(mysql_error());
    

     

    when when my db is empty it shows nothing.now i want it so when it is empty it shows off

  8. hey is there a way that if the total hours pass 40 it shows in red?

     

    i added up all the sums and it works a1!

     

    now in the query can i add something like an

     

    if Totalhours is over '40' show in red

     

     

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