Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Posts posted by vinpkl

  1. <?php
      $qry="select * from testimonials";
      $result=mysql_query($qry);
      $i = 0;
      while($row = mysql_fetch_array($result)) {
        $testimonial=$row['testimonial'];
        echo "<table>";
        echo "<tr>";
        echo (($i % 2) ? "<td width='100%' id='white'>" : "<td width='100%' id='grey'>") . $testimonial . "</td>";
        echo "</tr>";
        echo "</table>";
        $i++
      }
    ?>

     

    hi thorpe

     

    thanks.

     

    its works perfect.

     

    can u make this line little simple. like i want to add a new blank row after every row to give some spacing. where should i add.

     

    echo (($i % 2) ? "<td width='100%' id='white'>" : "<td width='100%' id='grey'>") . $testimonial . "</td>";
    

     

    vineet

  2. hi all

     

    i need to make my every alternative row means 2nd 4th 6th 8th result row background grey. I using the below loop which displays the result.

     

    but how can i make rows background different.

     

    <?php

    $qry="select * from testimonials";

    $result=mysql_query($qry);

    while($row = mysql_fetch_array($result))

    {

    $testimonial=$row['testimonial'];

    echo "<table>";

    echo "<tr>";

    echo "<td width=100%>". $testimonial . "</td>";

    echo "</tr>";

    echo "</table>";

    }

    ?>

     

    vineet

  3. The sample code from that link works for me in IE7.

     

    The code expects a form element with an id of f1_upload_process. IE reports the error when the element does not exist, while the other two browsers ignore it.

     

    hi PFM

     

    I wanted to edit this code but the forum said that you limit exceeded.

     

    so here is what i found. This was also part of code. If i write this line

    <script language="javascript" type="text/javascript">
    window.top.window.stopUpload(<?php echo $result; ?>);
    </script> 
    

     

    then i receive error otherwise not.

     

    do IE7 doesnt recognise window

     

    vineet

  4. hi PFM

     

    i need a little help. i m using the script from the url that u gave

     

    <script language="javascript" type="text/javascript">
    function startUpload(){
         document.getElementById('f1_upload_process').style.visibility = 'visible';
          document.getElementById('f1_upload_form').style.visibility = 'hidden';
          return true;
    }
    
    function stopUpload(success){
          var result = '';
          if (success == 1){
             result = '<span class="msg">The file was uploaded successfully!</span>';
          }
          else {
             result = '<span class="emsg">There was an error. !</span>';
          }
          document.getElementById('f1_upload_process').style.visibility = 'hidden';
          document.getElementById('f1_upload_form').innerHTML = result;
    document.getElementById('f1_upload_form').style.visibility = 'visible';      
              return true;   
    }
    </script>
    

     

    This code give me error "object expected on line 23" in status bar in IE7.

     

    I dont get any error in Firefox or opera.

     

    do i need to change anything acording to Internet Explorer. Or how switch off this error.

     

    This is the line where i get error

    document.getElementById('f1_upload_process').style.visibility = 'hidden';
    

     

    vineet

  5. Have you looked into using javasctipy

    I used to have a hidden dive that was fixed to the height and width of the screen with an image in the middle, all transparent

     

    When they hit sumbit the div gets unhidden and the user is unable to access the page

     

    hi gevan

     

    that is also good idea.

    but how will the div know that the image has been uploaded and it can become hidden again.

     

    vineet

  6. hi all

     

    i have a form that uploads the image. Till the file get uploaded i want to show an uploading animated icon adjacent to input type file field to show user that the uploading is in progress. when uploading finishes it should disappear.

     

    i dont want to go for progress bar as its not an easy task.

     

    <?php require_once("../config.php");
    
    $msg="";
    if(isset($_REQUEST['submit']))
    {
    $loc=$_REQUEST['banner_loc'];
    $path=$_FILES['banner_image']['name'];
    move_uploaded_file($_FILES['banner_image']['tmp_name'], "../graphics/" . $_FILES['banner_image']['name']);
    
    $qry="insert into banners_homepage(location,banner_image) values('$loc', '$path')";
    
    if(mysql_query($qry))
    $msg="Banner Inserted successfully";
    else
    $msg="Error Inserting Banner";
    }
    
    ?>
    

     

    <input type="file" name="banner_image" id="banner_image" size="60" />
    

     

    vineet

  7. hi all

     

    i m using the below script to check live check user in database.

     

    This script works fine for me. I just need to have the same effect when the user enters the username and his cursor is still in the input box.

     

    At present to show mesage whether the username exists or not the customer has to enter the username and then put the cursor in the next input field.

     

    <script type="text/javascript"> 
    function toggle_username(userid) { 
        if (window.XMLHttpRequest) { 
            http = new XMLHttpRequest(); 
        } else if (window.ActiveXObject) { 
            http = new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
        handle = document.getElementById(userid); 
        var url = 'ajax.php?'; 
        if(handle.value.length > 0) { 
            var fullurl = url + 'do=check_username_exists&username=' + encodeURIComponent(handle.value); 
            http.open("GET", fullurl, true); 
            http.send(null); 
            http.onreadystatechange = statechange_username; 
        }else{ 
            document.getElementById('username_exists').innerHTML = ''; 
        } 
    } 
    
    function statechange_username() { 
        if (http.readyState == 4) { 
            var xmlObj = http.responseXML; 
            var html = xmlObj.getElementsByTagName('result').item(0).firstChild.data; 
            document.getElementById('username_exists').innerHTML = html; 
        } 
    } 
    </script> 
    <input id="username" type="text" name="username" onchange="toggle_username('username')" /><br /> 
    <div id="username_exists" style="font-size: 11px;font-weight: bold;color:#FF3300"> </div> 
    

     

    vineet

  8. crawlers see the page as a browser would so it prints out all the html and titles  not the varibles to gain its content

     

     

    hence how places like myspace have profiles indexed its all varible driven

     

    hi dropfaith

     

    it means that i can use dynamicaly generated titles with no worries.

     

    and the same goes for the content also. we dont need to insert static content in our dynamic pages to get them indexed.

     

    vineet

  9. hi all

     

    my pages title are coming dynamically on the click of the link.

     

    The title is not written manually. Its dynamic like

    <title><?php echo  $dealer_name ." ". $ct_name . "USA" ?></title>
    

     

    so my question is that google and yahoo crawlers will crawl the title when the page link is clicked and the title outputs the actual name not the variable name.

     

    because if crawlers crawl the page title when the page is on server but not opened in any browser then the my page title will consist of only variable names and those mean nothing to crawler.

     

    vineet

  10. Most Linux distros offer the same functionality, often just wrapped within a different set of tools.

     

    CentOS, Fedora and Suse for instance all use the Yum package manager, while Debian and Ubuntu use apt*. Both Gentoo and slackware have there own tools for this same task. Gentoo however is a little different to most distros as it compiles all software from source. I probably wouldn't recommend it for a vps as some things will have trouble compiling within a limited amount of memory.

     

    Your package manager is your interface to software installation. So it really is the tool you need to get to know. Personally I hate Yum, though I work with several servers that insist on using Distros that use it by default.

     

    apt-get is my favourite package manager (this can be found in both Debian and Ubuntu) as it is quite simple to use yet extremely powerful. To be honest though, you just need to pick one and get to know it well. They all offer much the same functionality.

     

    hi thorpe

     

    i wil keep these things in mind and wil search on it more.

     

    vineet

  11. PHP is generally very independent of operating system.  There are some extensions that require a certain OS, but all of the major/official ones either work as is or can work under any OS that supports PHP.

     

    As for which distro, perhaps some linux guru can give you advice on that.  I personally would probably go with Fedora Core, since it and Ubuntu are the only two in that list that I've used.  So, I'm pretty much useless on your first question ;p.

     

    hi corbin

     

    like u said u have used fedora and ubuntu.

     

    so what diference do u find between them

     

    vineet

  12. hi all

     

    i m present at shared hosting and want to move to vps hosting.

     

    My server vps hosting provides me with different operating systems as

     

    under

     

    1) Centos

    2) debian

    3) fedora

    4) gentoo linux

    5) opensuse

    6) slackware linux

    7) ubuntu

     

    i would like to what all difference these operating systems have and

     

    what all impact will i have on my php scripting files.

     

    will i have to create my php mysql website again according to operating

     

    system i choose.

     

    vineet

  13. hi all

     

    i am generating a url dynamically in which

     

    <?php

    $cname= "Mobile Phones"

    ?>

     

    in the url i get

    Mobile%20Phones
    

     

    How can i replace %20 in it with - hyphen sign

     

    i have tried

    <?php
    $cname= "Mobile%20Phones"
    echo str_replace($cname,"%20","-");
    ?>
    

     

    not able to get it work.

     

    how can i make it echo "Mobile-Phones"

     

    vineet

  14. Place the chmod before the move_uploaded_file portion...

     

    hi premiso

     

    i moved the chmod line before the move_upload file portion. still get the same error.

     

    Warning: chmod() [function.chmod]: Operation not permitted in /home/gadgetso/public_html/admin/add_special_offer.php on line 10

     

    Warning: move_uploaded_file(../graphics/lg_logo.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/gadgetso/public_html/admin/add_special_offer.php on line 11

     

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpMr5bY8' to '../graphics/lg_logo.gif' in /home/gadgetso/public_html/admin/add_special_offer.php on line 11

     

    <?php require_once("../config.php");
    
    if(!isset($_SESSION['ADMIN_ACCESS']))
    header("Location:index.php"); 
    $msg="";
    if(isset($_REQUEST['submit']))
    {
    $loc=$_REQUEST['offer_loc'];
    $path=$_FILES['offer_image']['name'];
    chmod("../graphics/", 0777); 
    move_uploaded_file($_FILES['offer_image']['tmp_name'], "../graphics/" . $_FILES['offer_image']['name']);
    
    $qry="insert into special_offers(location,offer_image) values('$loc', '$path')";
    
    if(mysql_query($qry))
    $msg="Offer Inserted successfully";
    else
    $msg="Error Inserting Offer";
    }
    ?>
    

     

    vineet

  15. hi premiso

     

    i found chmod() and used it and getting the error.

     

    Warning: move_uploaded_file(../graphics/bank_logo.gif) [function.move-uploaded-file]: failed to open stream:

     

    Permission denied in /home/gads/public_html/admin/add_special_offer.php on line 12

     

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpksAvdQ' to

     

    '../graphics/bank_logo.gif' in /home/gads/public_html/admin/add_special_offer.php on line 12

     

    Warning: chmod() [function.chmod]: Operation not permitted in

     

    /home/gads/public_html/admin/add_special_offer.php on line 13

     

    <?php require_once("../config.php");
    
    if(!isset($_SESSION['ADMIN_ACCESS']))
    header("Location:index.php"); 
    $msg="";
    if(isset($_REQUEST['submit']))
    {
    $loc=$_REQUEST['offer_loc'];
    $path=$_FILES['offer_image']['name'];
    move_uploaded_file($_FILES['offer_image']['tmp_name'], "../graphics/" . $_FILES['offer_image']['name']);
    chmod("../graphics/",0777); 
    
    $qry="insert into special_offers(location,offer_image) values('$loc', '$path')";
    
    if(mysql_query($qry))
    $msg="Offer Inserted successfully";
    else
    $msg="Error Inserting Offer";
    }
    
    ?>
    

     

    vineet

  16. If you are on a shared, potentially, if you are on dedicated doubtful.

     

    The only other option is to try to use the chmod function in php to change the folder permission for upload than change them back after upload.

     

    hi premiso

     

    yes i m on shared hosting and i dont want to take risk.

     

    if you have used chmod() in your projects then can u explain how to use. here is my code

    <?php require_once("../config.php");
    
    $msg="";
    
    if(isset($_REQUEST['submit']))
    {
    $loc=$_REQUEST['offer_loc'];
    $path=$_FILES['offer_image']['name'];
    move_uploaded_file($_FILES['offer_image']['tmp_name'], "../graphics/" . $_FILES['offer_image']['name']);
    
    
    $qry="insert into special_offers(location,offer_image) values('$loc', '$path')";
    
    if(mysql_query($qry))
    $msg="Offer Inserted successfully";
    else
    $msg="Error Inserting Offer";
    }
    
    ?>
    

     

    vineet

  17. WS_FTP, from what I remember, was pretty bad software. I tend to stick with SmartFTP or FireFTP, I do not like FireFTP too much since it is buggy, but the free version of SmartFTP is great.

     

    The option in WS_FTP you want is "chmod(unix)" and change that to 0777

     

    hi premiso

     

    so i download smartftp if it has free version.

     

    vineet

  18. hi premiso

     

    i m using ws ftp.

     

    when i right click my folder i dont get properties option there.

     

    there are these below options

    change folder

    make folder

    delete folder

    transfer folder

    rename folder

    chmod(unix)

    refresh list

    folder list

     

    so do i need to use anyother ftp software

     

    vineet

  19. what os are you using? chmod command changes files permissions in linux, dno about windows.

     

    hi ram

     

    i have tested this on my testing server that is xampp and its working fine.

     

    i m getting this error when i m testing online on linux server.

     

    so what to do.

     

    vineet

     

  20. hi all

     

    i am uploading an image and getting the below error

     

    Warning: move_uploaded_file(../graphics/home_bigad2.jpg) [function.move-uploaded-file]: failed to open stream: 
    
    Permission denied in /home/gads/public_html/vineet/adminpaji/add_special_offer.php on line 12
    
    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpXjKkp7' to 
    
    '../graphics/home_bigad2.jpg' in /home/gads/public_html/vineet/adminpaji/add_special_offer.php on line 12
    
    

     

    This is my php code

    <?php require_once("../config.php");
    
    $msg="";
    
    if(isset($_REQUEST['submit']))
    {
    $loc=$_REQUEST['offer_loc'];
    $path=$_FILES['offer_image']['name'];
    move_uploaded_file($_FILES['offer_image']['tmp_name'], "../graphics/" . $_FILES['offer_image']['name']);
    
    
    $qry="insert into special_offers(location,offer_image) values('$loc', '$path')";
    
    if(mysql_query($qry))
    $msg="Offer Inserted successfully";
    else
    $msg="Error Inserting Offer";
    }
    
    ?>
    

     

    vineet

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