Jump to content

s.prema@yahoo.com

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Posts posted by s.prema@yahoo.com

  1. Hello,

     

    Anybody there to help!!!

     

    I used the code to zip the excel file. It is zipped but got 'file corrupted' message opening the excel after extraction :'(

     

    <?php

    function uncompress($srcName, $dstName) {

    $string = implode("", gzfile($srcName));

    $fp = fopen($dstName, "w");

    fwrite($fp, $string, strlen($string));

    fclose($fp);

    }

     

    function compress($srcName, $dstName)

    {

    $fp = fopen($srcName, "r");

    $data = fread ($fp, filesize($srcName));

    fclose($fp);

     

    $zp = gzopen($dstName, "w9");

    gzwrite($zp, $data);

    gzclose($zp);

    }

     

    compress("a.xls","a.zip");

    uncompress("a.zip","a1.xls");

    ?>

     

     

    Help me!

     

    Or any library files are to be included??

    Thanks.

     

    -Prema

     

  2. Hello,

     

    Here is my snippet,

    <script>

    function valid(name)

    {

           

    var t="<?php $_SESSION['FName']='<script>name</script>'; ?>";

    }

    </script>

    <input name="chk" type="button" value="Submit" onclick="valid('Joe');" />

     

     

    I need to store the variable 'name' in the php session variable 'FName'.

    Code is not exact or logical. But it could be similar.

    Struggling more.

    :confused:

    Need Help!!!

     

    Thanks.

  3. Hello...

    I need to convert a jpeg image [image is a bar chart, generated thru php ] into a pdf file and send as an attachment in mails.

    Can php experts help to achieve this ??

     

    Thank you.

  4. Hello everyone,

    I need to create a quiz module with db integration.  User should select one of the three options each carry different points.  Questions, options, points are stored in respective tables. Question count is dynamic and should be displayed with pagination [as link, to the same page quiz.php using mysql limit query], 5 questions per page. Now I am having up to 4 pages. And user can submit the quiz only in last page not before. Till this all done.

     

    Problem is, how to carry they selected answers over pages....????????

     

    Please note,

    question id is dynamic and concatenated with the letter 'Q', and stored as hidden value,

    option id is also dynamic and concatenated with the word 'OPT', radio button array is used for every question.

    So, for every question, Q1 stores Question id, OPT[] holds the 3 options

     

    How to submit all these selected answers in the 4th page.

    Is it possible thru javascript.. or in PHP itself?

    :'(

    Very Urgent

    Thank U

     

     

  5. Hello...

     

    I need to create two image base to display two independent bar charts in a single page.

    One I could,  how to create another in same page like.....

     

    $img_width=800;

    $img_height=200;

    $img=imagecreatetruecolor($img_width,$img_height);

     

    this image is created on top left of the screen..

    using $img i created a bar like, using  imagefilledrectangle() on it

    now I need to create another image beneath the first one.

     

    Help Me!

  6. Hello

     

    My php page has,

     

    <input type="radio" name="group1" value="Milk"> Milk<br>

    <input type="radio" name="group1" value="Butter" checked> Butter<br>

    <input type="radio" name="group1" value="Cheese"> Cheese

    <hr>

    <input type="radio" name="group2" value="Water"> Water<br>

    <input type="radio" name="group2" value="Beer"> Beer<br>

    <input type="radio" name="group2" value="Wine" checked> Wine<br>

     

    The groups and the values are dynamic. While submitting the page, how can I get the total number of groups in the page ??

    How to get the group count in print_r() ???

     

    Thanks.

  7. I need to develop a graphical /  chart representation of a survey.

    User will input the answer for a set of questionnaire.

    Each question has 3 options, option A holds 5 points, B holds 2 points, whereas option C holds 0.

    After completing the questionnaire, according to options selected by user, pie chart or bar chart should be generated.

     

    Anybody did this before.. how to achieve this..?

     

  8. Hello

     

    Actually I tried the following to export db and store the sql file in my source server,

    mysqldump  -u admin -p instglive  > /home/admin/public_html/test/storage/s.sql

    this is working fine.

     

    But now I need to import this sql file onto a remote server from my source server,

    what will be the command to work on putty????

    In this following command where to mention the remote IP or remote path,

    mysql  -h 222.22.22.22 -u dev -p  instglive < /home/dev/public_html/test/instglive

     

    Its urgent.

    Thank u

  9. Hello

     

    I need to transfer a file from my ftp server to remote ftp server.

    Here is my code, but it gives error as,

    Warning: ftp_put() [function.ftp-put]: Can't open that file: No such file or directory

     

    <?php

    ob_start();

     

    if(!file_exists('storage/glive.sql')) echo "File not found";

    //ftp details of sedtination server

    $ftp_server="222.22.22.222";

    $ftp_user="ferghco";

    $ftp_password="*********";

     

    $conn_id = ftp_connect($ftp_server);

    $login_result = ftp_login($conn_id, $ftp_user, $ftp_password);

     

    if((!$conn_id) || (!$login_result))

    {

                echo "FTP connection has failed!";

                echo "Attempted to connect to $ftp_server for user $ftp_user";

    exit();

      }

     

    $upload = ftp_put($conn_id,'/test/glive1.sql', 'storage/glive.sql', FTP_BINARY);

    if (!$upload) { echo 'FTP upload failed!'; }

     

    ob_end_flush();

    ?>

     

    Can anybody give the solution??????

  10. Error occurring

     

    <?php

    #!/bin/bash

     

    $hostname='localhost';

    $un= 'root';

    $pwd='';

    $db='test';

    $link=mysql_connect($hostname, $un, $pwd);

    if(!$link)

      die('Could not connect: ' . mysql_error());

    if(!mysql_select_db($db,$link))

      die('Could not link db: ' . mysql_error());

    $f='ttt'; 

    $d='DESCRIPTION';

     

    echo "DELIMITER ;;" >tmp.sql ;

     

    for f in "mysqlshow test | sed '1,4d;s/|//g;$d' | grep -v 'LOGGING'";

    do

      echo "CREATE TRIGGER t_'$f' AFTER INSERT ON '$f' FOR EACH ROW BEGIN insert into LOGGING (table, username, logtime) values ('$f',CURRENT_USER(), NOW()); end ;; " >>tmp.sql ;

    done

    echo "DELIMITER ;" >>tmp.sql

     

    ?>

     

    can u explain the mysqlshow command..

    $f holds the table name whereas $d ??

     

    giving error as Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\xampp\htdocs\xampp\Prema\trig.php on line 16

     

    ie., in the command..

    expalin pls...

     

     

  11. Here is my code:

    <?php

    #Staging

    $hostname='localhost';

    $un= 'admin';

    $pwd='******';

    $db='instglive';

    $link=mysql_connect($hostname, $un, $pwd);

    if(!$link)

      die('Could not connect: ' . mysql_error());

     

    if(!mysql_select_db($db,$link))

      die('Could not link db: ' . mysql_error());

     

     

    #Live

    $hostname1='222.666.73.91';

    $un1= 'test';

    $pwd1='*******';

    $db1='testdb';

    $link1=mysql_connect($hostname1, $un1, $pwd1);

    if(!$link1)

      die('Could not connect: ' . mysql_error());

     

    if(!mysql_select_db($db1,$link1))

      die('Could not link db: ' . mysql_error());

     

     

    $d="CREATE TABLE ".$db1.".".student." LIKE ".$db.".".student";

    if(!mysql_query($d)) echo mysql_error();

     

    ?>

     

    I need to work out the create table query on instglive db...

    anybody there to help????

  12. Hello,

     

    I m trying to create a new table on server B as like a table on server A in php script.

    The steps I did are,

    1. Using mysql_connect() and mysql_select_db() I established connection on Server A & B with 2 different variable sets, say variable $db1 holds the db of Server A and variable $db2 holds the db of Server B.

     

    2. Tables are list from both the DBs

     

    3. Needed to create missing tables on Server B [ie., copy missed tables with rows from server A to Server B]. Here, it is struggling................

     

    How to create or copy a specific table from one server to another server or IP in PHP ???

     

    Can anybody help?????? :(

    Its urgent.

     

    Thanks in advance.

     

     

     

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