Jump to content

ayok

Members
  • Posts

    340
  • Joined

  • Last visited

    Never

Posts posted by ayok

  1. Sorry, I missed some lines above it

     

    <?php
    $show1 = mysql_query("SELECT * FROM category WHERE id_cat='$id'") or die(mysql_error());
    $datakategori = mysql_fetch_array($show1);
    echo "<H3>$datakategori[name]</H3><br><img align='left' src='../pics/$datakategori[pic]'<br><H5>$datakategori[description](<a href=edit_cat.php?id=$datakategori[id_cat]>edit kategori</a> | <a href=add_cat.php>add kategori</a>)<H5>";
    
    $show = mysql_query("SELECT service.*,category.name FROM service LEFT JOIN category on service.category=category.id_cat WHERE category='$id'") or die(mysql_error());
    echo "<table border=0><tr bgcolor='#D0DCE0'><th>Service</th><th>Description</th><th>Duration (minutes)</th><th>Prices</th></tr>";
    
    
        while (($data = mysql_fetch_array($tampil)) && (mysql_num_rows($tampil) > 0))
        {
            echo "<tr>";
            echo "<td bgcolor='#D47FFF'>$data[name_serv]</td>";
            echo "<td bgcolor='#FF55FF'>$data[desc_serv]</td>";
            echo "<td bgcolor='#D47FFF'>$data[minutes]</td>";
            echo "<td bgcolor='#FF55FF'>$data[price]</td>";
            echo "<td><a href='' onclick='disp_confirm()'>delete</a><br><a href=edit_service.php?id=$data[id_serv]>edit</a></td></tr>";
        }
        echo "</table>";
    }?>
    
    <script type="text/javascript">
    function disp_confirm(){
        var msg = "Do you really want to delete this?";
        if (confirm(msg)){
            window.location("delete.php?id=$datakategori[id_cat]");
        }
        return false;
    }
    </script>

  2. <?php
    $show = mysql_query("SELECT service.*,category.name FROM service LEFT JOIN category on service.category=category.id_cat WHERE category='$id'") or die(mysql_error());
    echo "<table border=0><tr bgcolor='#D0DCE0'><th>Service</th><th>Description</th><th>Duration (minutes)</th><th>Prices</th></tr>";
    
    
        while (($data = mysql_fetch_array($tampil)) && (mysql_num_rows($tampil) > 0))
        {
            echo "<tr>";
            echo "<td bgcolor='#D47FFF'>$data[name_serv]</td>";
            echo "<td bgcolor='#FF55FF'>$data[desc_serv]</td>";
            echo "<td bgcolor='#D47FFF'>$data[minutes]</td>";
            echo "<td bgcolor='#FF55FF'>$data[price]</td>";
            echo "<td><a href='' onclick='disp_confirm()'>delete</a><br><a href=edit_service.php?id=$data[id_serv]>edit</a></td></tr>";
        }
        echo "</table>";
    }?>
    
    <script type="text/javascript">
    function disp_confirm(){
        var msg = "Do you really want to delete this?";
        if (confirm(msg)){
            window.location("delete.php?id=$datakategori[id_cat]");
        }
        return false;
    }
    </script>

  3. Hi,

    So far my javascript is:

    function disp_confirm(){
        var name=confirm("Do you really want to delete this?")
        if (name==true){
            window.location("delete.php?id=$data[id_cat]")
        }
        else{
    	return true;
    	}
    }

     

    and the link where to click:

    <a href='' onclick='disp_confirm()'>delete</a>

     

    The confirm box is popuped but if i click on ok or cancel it will open the index page. Anybody can help me?

     

    Thank you,

    ayok

  4. <script type="text/javascript">

    function disp_confirm(){

        var name=confirm("You're going to delete this item, would you like to process it?")

        if (name==true){

            window.location("delete.php?id=$data[id_cat];")

        }else{

          return true; // change true to false if it doesn't work

        }

    }

    </script>

     

    Hi thanks roopurt,

     

    It is return to the page when i click "cancel", but it doesn't delete when i click on "ok".

    Is there something wrong with the window location?

     

    ayok

  5. Hi there,

     

    I have a question regarding the confirm box of javascript. I'd like to pop up a confirm box when the admin wants to delete an item.

    So when the person click on "ok", the item will be delete, but if "cancel" is clicked, then it would stay on this page. But I cannot get it works.

     

    I've tried this script:

    <script type="text/javascript">
    function disp_confirm(){
        var name=confirm("You're going to delete this item, would you like to process it?")
        if (name==true){
            window.location("delete.php?id=$data[id_cat];")
        }
    }
    </script>

     

    And this code on the delete:

    <a href='' onclick='disp_confirm()'>delete</a>

     

    Could anybody help me with this?

     

    Thank you,

    ayok

  6. Hi,

    I have a question. I use dreamweaver to make a website, and we can make pop up windows with it by adding behavior. It will automaticly add this script

    <script type="text/JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }
    //-->
    </script>

     

    However, when no thumb appears when we rollover on the link that will pop up a window. It makes the visitor doesn't notice that there is a link on that.

    Thus, my question is, how to make the thumb appears on the link? (like normal links)

     

    Thank you,

     

    ayok

  7. the script works fine in localhost, but when I tried in my webserver, i got this error: "Allowed memory size of 8388608 bytes exhausted (tried to allocate 6400 bytes) "

     

    Why is that?

     

    thanks,

    ayok

  8. <?php
    session_start();
    if(!empty($namauser) AND !empty ($passuser))
    {
    include "../dbconnect.php";
    echo "<H3 align=center>Add Picture</H3> 
    <FORM enctype=MULTIPART/FORM-DATA METHOD=POST ACTION=input_pic.php>
    <table align=center border=0>
    <tr><td>Title: </td> <td><INPUT TYPE=TEXT SIZE=60 NAME= title></td></tr>
    <tr><td>Category: </td> <td><SELECT NAME=category>
    <OPTION VALUE=0 SELECTED>--Choose Category--";
    $tampil=mysql_query("SELECT * FROM category ORDER BY id");
    
    while($data=mysql_fetch_array($tampil))
    {
    	echo "<OPTION VALUE=$data[id]>$data[name]";
    }
    echo "</OPTION></SELECT></td></tr>
    <tr><td>Upload:</td> <td>
    <input type=file name=fupload></td></tr>
    </table>
    <INPUT TYPE=SUBMIT VALUE=Add>
    
    </FORM><a href=foto2.php>Show and delete pictures</a><BR>
    <a href=logout.php>logout</a>";
    }else{
    echo "You have to login before adding new items<BR>";
    echo "<a href=form_login.php>Login</a>";
    }
    ?>
    
    <style type="text/css">
    <!--
    body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #FFFFFF;
    }
    body {
    background-color: #993300;
    }
    a {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #00FF00;
    font-weight: bold;
    }
    a:link {
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    color: #FFFF00;
    }
    a:hover {
    text-decoration: underline;
    color: #FFFFFF;
    }
    a:active {
    text-decoration: none;
    }
    -->
    </style>

  9. There are two tables. One is pictures table, and the other is category table.

     

    On the xml I want to get the pictures are shown per category. So it should look like:

    <gallery name="Category1">
    		<image source="pics/original/118.jpg" thumb="pics/118.jpg" title="first pic"/>
    		<image source="pics/original/121.jpg" thumb="pics/121.jpg" title="second pic"/>
    	</gallery>
    <gallery name="Category2">
    		<image source="pics/original/122.jpg" thumb="pics/118.jpg" title="third pic"/>
    		<image source="pics/original/123.jpg" thumb="pics/121.jpg" title="forth pic"/>
    		<image source="pics/original/124.jpg" thumb="pics/122.jpg" title="fifth pic"/>
    	</gallery>
    <gallery name="Category3">
    		<image source="pics/original/125.jpg" thumb="pics/118.jpg" title="sixth pic"/>
    		<image source="pics/original/126.jpg" thumb="pics/121.jpg" title="seventh pic"/>
    		<image source="pics/original/127.jpg" thumb="pics/122.jpg" title="eight pic"/>
    	</gallery>

  10. I see..

    Thanks MadTechie, it works now.

     

    However, I still have a question regarding uploading image. The script is working on localhost with IE. It uploads and resizes the picture, but if I test on Opera, it's not uploaded. Do you know why?

     

    Thanks,

    ayok

  11. Thanks for the reply Barand,

     

    I try to correct the script.

    <?php
    header("Content-type: text/xml"); 
    include "dbconnect.php";
    $category = mysql_query("SELECT id,name FROM category ORDER BY id") or DIE(mysql_error());
    
    $xml_output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 
    $xml_output .= "<menu>\n"; 
    
    for($x = 0 ; $x < mysql_num_rows($category) ; $x++){ 
        $row = mysql_fetch_assoc($category); 
        $row['name'] = str_replace("&", "&", $row['name']); 
        $row['name'] = str_replace("<", "<", $row['name']); 
        $row['name'] = str_replace(">", ">", $row['name']); 
        $row['name'] = str_replace("\"", """, $row['name']); 
        $xml_output .= "<gallery name=\"" .$row['name']."\">\n";
    
    $pictures = mysql_query("SELECT pictures.*,category.id FROM pictures,category WHERE pictures.category=category.id") or DIE(mysql_error());
        for($x = 0 ; $x < mysql_num_rows($pictures) ; $x++){
        	$row2 = mysql_fetch_assoc($pictures); 
        	$xml_output .= "\t<image source=\"original/" .$row2['image']."\""; 
        	$xml_output .= "\tthumb=\"" .$row2['image']."\"";
        
    	$row2['title'] = str_replace("&", "&", $row2['title']); 
        	$row2['title'] = str_replace("<", "<", $row2['title']); 
        	$row2['title'] = str_replace(">", ">", $row2['title']); 
        	$row2['title'] = str_replace("\"", """, $row2['title']); 
        	$xml_output .= "\ttitle=\"" .$row2['title']."\"/>\n";
        }	
    
        $xml_output .= "</gallery>\n";
    }
    
    $xml_output .= "</menu>\n"; 
    echo $xml_output;
    ?>

     

    But i keep getting wrong result. Could you tell me where I do wrong?

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