Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Posts posted by techker

  1. hey guys i was woundering if any body can point me in the right direction.

     

    so i have a database that store information of clients like when orders done in the shopping cart.so i recently made a box on the front page saying the last date the client ordered in the shopping cart.

     

    but he probleme im having is when there is nothing in there it gives no matches ..but the hole page gets messt up,even if i made it an include..

     

    here is the page that hase the query (the include page)

     

    <?php // Connects to your Database
    mysql_connect("localhost", "kk", "hhh") or die(mysql_error());
    mysql_select_db("hhh") or die(mysql_error());?>
    
    <?php
    $QQQ1 = mysql_query("SELECT c.NoCommande AS NoCommande, d.Quantite AS Quantite, c.UName AS Usager, c.DateCommande AS Date, p.SkuFabriquant AS Sku, p.DescriptionCourte AS NomProduit
    FROM tblCommande AS c
    LEFT JOIN (
    tblCommandeDetail AS d
    CROSS JOIN tblProduits AS p
    ) ON ( p.IDProduit = d.IDProduit
    AND d.NoCommande = c.NoCommande )
    WHERE c.UName = '$USERNAME'
    ORDER BY Date LIMIT 1 , 1  ");
    if(!$QQQ1) die(mysql_error());
    $err = mysql_num_rows($QQQ1);
    if($err == 0) die("No matches met your criteria.");?>
    <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">
    <!--
    
    .echo2 {
        color: 000000;
        text-decoration: none;
    } 
    
    -->
    </style>
    </head>
    
    <body>
    <?php while ($info=mysql_fetch_array($QQQ1)) {
                 
    		   echo "</b><br> </i>";
                   echo "<span class='echo2'>".$info['Date']."</span>";
    		    } ?>
    </body>
    </html>
    

     

    so it only put the last date.in the box i made.i don't know if im clear lol

     

     

  2. i got this that views the directory and lists the images name.now the only thing i need to know is to link the name to a delete file that hase the unlink function

     

    <?php
    
    $imgdir = './'; // the directory, where your images are stored
    $allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show
    
    $dimg = opendir($imgdir);
    while($imgfile = readdir($dimg))
    {
      if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
      {
       $a_img[] = $imgfile;
       sort($a_img);
       reset ($a_img);
      } 
    }
    
    $totimg = count($a_img); // total image number
      
    for($x=0; $x < $totimg; $x++)
    {
      $size = getimagesize($imgdir.'/'.$a_img[$x]);
    
      // do whatever
      $halfwidth = ceil($size[0]/2);
      $halfheight = ceil($size[1]/2);
      echo 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />';
    }
    
    ?>
    

     

    i need the link to echo the name of the file to delete.for the unlink to work

  3. hey guys i have a script that inserts info in a mysql database and moves an image to a directory and inserting the path in the db.(instead of using the database to store images)

     

    no the problem is that when you delete the query it does not delete the pic.so he is going to have a nasty accumulation of images after a couple of years..lol

     

    so i was wondering if somebody can tel me how or point me in the right direction to haw to make a script that will show the images in a directory and you can delete the unwanted pic..

  4. its not a query it only an delete image

    cause i insert the path of the image in the databse not the image it self.

     

    <?php
    include('connection.php'); 
    
    
    if(isset($_GET['bin_data']) && !empty($_GET['bin_data']))
    {
        $file = $_GET['bin_data'];
    
        echo "<p>Deleted $file<br />\n" .
             'You\'ll be redirected to Home Page after (4) Seconds<p>';
    
        echo '<meta http-equiv="Refresh" content="4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data='.$file. '">';
    }
    else
    {
        echo "Error deleting $file";
    }
    
    ?>
    

  5. ok i got it deleteing but the funy thing is it says it deleted the pic but it still there?lol

     

    the redirecting does not work do

     

    echo '<meta http-equiv="Refresh" content="4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data='.$info['bin_data'] . '">';
    

    Edit:

     

    ok i replace

    bin_data='.$info['bin_data'] . '">';

    by

    bin_data='.$file. '">';

     

    but it still does not delte.it says it does..

     

     

  6. i only wish it would work now..lol

     

    i think it is at the connection.

     

    <?php
    mysql_connect("localhost", "root", "") or die(mysql_error()) ;
    mysql_select_db("eppa") or die(mysql_error()) ;
    
    $SQL=" SELECT * 
    FROM `supps`WHERE bin_data = ".$_GET['bin_data']." 
    LIMIT 0 , 30 "; 
    
    $fileSQL=mysql_query($SQL); 
    
    ?>
    

  7. hey guys i need to echo a link with and echo in it..

     

    like this

    content=4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=echo{$info['bin_data']}>";
    [php
    i tryed it and it does not work? the page show this when it links
    "; } ?>
    se the reason why is this is a picture delter and it redirects to a thumbnail deleter but i need to echo the name so it can delete it.
    
    [code]
    <? include'connection.php'?>
    
    <?
    $file = $_GET['bin_data'];
    if (!unlink($file))
      {
      echo ("Error deleting $file");
      }
    else
      {
      
      echo ("Deleted $file");
      echo "You'll be redirected to Home Page after (4) Seconds";
              echo "<meta http-equiv=Refresh content=4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=echo{$info['bin_data']}>";
      }
    
    
    
    ?>
    

     

  8. hm good point i was pasting the td to link the image to an info center..but you know what..screw it i will put a more button..lol

     

    i get what your saying for the mysql.thanks for the heads up i very new at this..

     

     

    edit:

     

    by the way is there a way if i only use one td to make it on a horizontal line?cause now it echos in a vertical line?

  9. <?php // Connects to your Database
    mysql_connect("localhost", "r", "t") or die(mysql_error());
    mysql_select_db("gym") or die(mysql_error());
    
    $QQQ1 = mysql_query("SELECT * FROM supps WHERE bin_data ORDER BY RAND() LIMIT 4 ");
    if(!$QQQ1) die(mysql_error());
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <table width="525" height="359" border="0" cellpadding="0" cellspacing="0">
      <tr><?php while ($info=mysql_fetch_array($QQQ1)) {?>
        <td valign="top"><table width="525" height="160" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="160"><div align="center"><?php echo '<a href="/admin/photo/'. $info['bin_data'] .'"target="_blank"><img src="/admin/photo/thumbs/'. $info['bin_data'] .'" border="0" alt="" /></a><br />'."\n";?></div></td>
            <td><div align="center"><?php echo '<a href="/admin/photo/'. $info['bin_data'] .'"target="_blank"><img src="/admin/photo/thumbs/'. $info['bin_data'] .'" border="0" alt="" /></a><br />'."\n";?></div></td>
            <td><div align="center"><?php echo '<a href="/admin/photo/'. $info['bin_data'] .'"target="_blank"><img src="/admin/photo/thumbs/'. $info['bin_data'] .'" border="0" alt="" /></a><br />'."\n";?></div></td>
            <td><div align="center"><?php echo '<a href="/admin/photo/'. $info['bin_data'] .'"target="_blank"><img src="/admin/photo/thumbs/'. $info['bin_data'] .'" border="0" alt="" /></a><br />'."\n";?></div></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td valign="top"> </td>
      </tr>
      <? }?>
    </table>
    </body>
    </html>
    
    

  10. ok.i have a page for my friend that contains an iframe that i want to extract for the database some images  and text uder it.just to show some products.

     

    so i want on the top line 4 boxes with diffrent images in each.

  11. i tryed using the example in the sticky

     

    $QQQ1 = mysql_query("SELECT
    *
    FROM
    supps AS t1
    INNER JOIN 
    (
        SELECT
        ROUND(RAND() * (SELECT MAX(id) FROM supps)) AS id
    ) AS t2 
    ON
    t1.id >= t2.id 
    ORDER BY
    t1.id ASC 
    LIMIT 1;  ");
    

     

    works but all the same image?i need for diffrent

  12. hey guys i have a 2 quick question for you pros.

     

    i have a site that i made a database that contains products.now i have every thing set up to view the products like a catalogue.

     

    now on the site it self i made a product page in there i want to post the image and link it to the information page.that it's ok.

     

    now the part im scratching my head is i wan't to post like 4 images but i need them different like a gallery in a square,how can i fetch only like 5 images in random order.

     

    2 question.

     

    i wan't to make a cool background to put the product image and description but how can i make that same bgw repeat with another on the same page?cause usually u just put the fetch code once and it shows all the product in your database....

  13. well it works perfectly and like i said it does not put images in the database it move it to a folder

     

    if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))

     

    but i relly would like to store in a databse cause it would be lot more simpler..lol

     

    but i have tryed almost every tutorial out there with no success..

  14. i don't have an id but i have an inventory number.

     

    so in the database i don't know if it store the path?

    here is the add script.

     

    <?php
    
    
    $target = "images/big/";
    $target2= "images/thumbs/";
    $target3= "images/pics/";
    $target = $target . basename( $_FILES['photo']['name']);
    $target2 = $target2 . basename( $_FILES['thumb']['name']);
    $target3 = $target3 . basename( $_FILES['pics']['name']);
    
    $3 =$_POST['3mois'];
    $6 =$_POST['6mois'];
    $12 =$_POST['12mois'];
    //$pic=($_FILES['photo']['name']);
    //$thumb=($_FILES['thumb']['name']);
    $15 =$_POST['15mois'];
    //$desc=$_POST['description'];
    //$pics=($_FILES['pics']['name']);
    
    
    // Connects to your Database
    mysql_connect("localhost", "techker_techker", "techker") or die(mysql_error()) ;
    mysql_select_db("techker_techker") or die(mysql_error()) ;
    
    //Writes the information to the database
    mysql_query("INSERT INTO `hours` VALUES ('$3', '$6', '$12', '$15')") ;
    
    
    //if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
    
    //{
    //if(move_uploaded_file($_FILES['thumb']['tmp_name'], $target2))
    
    //{
    //if(move_uploaded_file($_FILES['pics']['tmp_name'], $target3))
    
    //{
    
    //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
    echo "You'll be redirected to Home Page after (4) Seconds";
              echo "<meta http-equiv=Refresh content=4;url=index.php>";
    }
    else {
    
    
    echo "Sorry, there was a problem uploading your file.";
    }
    //}
    //}
    
    ?>
    

     

    it's a good idea do to delete all at the same time.and by getting the path

     

     

  15. ok i have a question concerning the get variable.

     

    i have this script that is used to post pics with descriptions and prices.

     

    now the uploading side uses es if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) so it stores the image in a folder and links it to a description store in my database.

     

    now i can delete the info no prob in the database the only thing is the pic that was uploaded isn't deleted at the same time.

     

    so i did my research and found the unlink function.

     

    $file = "pic name";

    if (!unlink($file))

    {

    echo ("Error deleting $file");

    }

    else

    {

    echo ("Deleted $file");

    }

     

    now i know i can do it.but im not shure how.

     

    so i did a link on that description page to delete the db and another to delete the pic

     

    <a href="deleter_pic.php?photo=<?php echo $info['photo'] ?>">Delete</a></td>

     

     

    so basicly this <?php echo $info['photo'] ?> shows the pic name in the url bar. from the help of the data base.

     

    now i know i can go get it with

     

    $_GET['photo'] witch will read the info on the url (photo is the name of the pic from db)

     

    1rst question why do i get a 500 page?

     

    2nd question is there a way to do this without a db?

     

    like when you click on the pic it does the same as my delete link without the help of the database to show the pic name?

     

    and on the delete page in the filename to delete how would it read the url?

     

     

    or is there an easer way?

    is it clear ?lol

     

    thx for the help

    Reply With Quote

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