Jump to content

Russia

Members
  • Posts

    419
  • Joined

  • Last visited

Posts posted by Russia

  1. Hey guys I have a small issue, i have an upload that resizes the image into thumbnail by max width and ratios the width based on that.

    Here is my code

    $width = 100; //*** Set a Fix Width & Height (Auto caculate) ***//
    $size = GetimageSize($images);
    $height = round($width * $size[1] / $size[0]);
    $images_orig = imagecreatefromjpeg($images);
    $photoX = ImagesX($images_orig);
    $photoY = ImagesY($images_orig);
    $images_fin = ImageCreateTrueColor($width, $height);
    ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width + 1, $height + 1, $photoX, $photoY);
    ImageJPEG($images_fin, $new_images);
    



    What I am wanting to do is instead upload the image with a max height and ratio the width proportionally. What variables do I have to reverse?

  2. I am working on an uploader and slowly getting it working, I am uploading 3 images at once, and setting arrays for each one as keys, with an increment of ++1. I am wanting to resize the image before it gets copied to the thumbnail folder.

    I have this code.

    <?php
    if (isset($_POST['addpart'])) {
    
        $image = $_FILES['images']['tmp_name'];
        $name  = $_POST['username'];
        $i     = 0;
        foreach ($image as $key) {
    
            $fileData   = pathinfo(basename($_FILES["images"]["name"][$i]));
            $fileName[] = $name . '_' . uniqid() . '.' . $fileData['extension'];
            move_uploaded_file($key, "image/" . end($fileName));
    
        //get uploaded file info before we proceed with resize
        $image_name = $_FILES['images']['name'][$i]; //file name
        $image_size = $_FILES['images']['size'][$i]; //file size
        $image_temp = $_FILES['images']['tmp_name'][$i]; //file temp
        $image_size_info    = getimagesize($image_temp); //gets image size info from valid image file
    
    
            copy("image/" . end($fileName), "image_thumbnail/" . end($fileName));
            $i++;
        }
        echo 'Uploaded<br>';
        echo 'Main Image - ' . $fileName[0] . '<br>';
        echo 'Extra Image 1 - ' . $fileName[1] . '<br>';
        echo 'Extra Image 2 - ' . $fileName[2] . '<br>';
        echo '<hr>';
    
    }
    ?>



    Everything works with it. As you see, I started on getting the file info, but after that I am totally stuck on what to do after to resize the image proportionally with a maximum width of xPX and height to match it without looking distorted.

    Any help would be really appreciated. Thank You.

  3. Thanks, but how the server recognize that particular user from the other while both have the same public ip address ? how cookie can identify which one of them ?

    every ethernet/wifi card a computer or phone has is assigned a different physical address, i think it grabs data off of that.

  4. hey guys thanks for the upcoming support how do I set the blue to fill up the remaining width of the while maininfo div? I tried setting the width:auto
     

    <div class="maininfo">
    
        <div class="large">2</div>
    
        <div class="smallblock">
    
            <div class="smalltop">3</div>
    
            <div class="small">4</div>
    
        </div>
    
        <div class="smallblock">
    
            <div class="smalltop">5</div>
    
            <div class="small">6</div>
    
        </div>
    
    </div>
    .maininfo {
    
    
    
        width: 600px;
    
    
    
    }
    
    
    
    .large {
    
        float: left;
    
        height: 95px;
    
        background-color: blue;
    
        width:auto;
    
    }
    
    
    
    
    
    .smallblock {
    
        float: right;
    
        height: 90px;
    
        margin: 0 0 0 5px;
    
        width: 20%;
    
    }
    
    
    
    .small {
    
    background-color: red;
    
    height: 50%;
    
    width: 100%;
    
    }
    
    .smalltop {
    
    background-color: red;
    
    height: 50%;
    
    width: 100%;
    
        margin-bottom:5px;
    
    }
    
    

    Edit fiddle - JSFiddle

     

  5. Hey guys, I am working on something and keep getting some padding on my css navabar, its pretty simple but I cant figure out where it grabbing the padding from pushing it about 5 pixels to the right.

    jsfiddle live preview is a demo

    and here is a picture of the hover over.

    QfprKE0.png

    Notice the little gray space in between the hovered over Update Profile?

    I cant seem to find the code anywhere that would cause that. Anyone notice anything in my code?
     

                                                                                                    
    
                                                                <head>
    
    <title>2 Column CSS Layout</title>
    
    
    
    <style type="text/css">
    
    body {
    
    margin: 20px;
    
    
    
    font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
    
            background-color: #555;
    
    }
    
    #nav {
    
        text-align:center;
    
    }
    
    
    
       /* Begin Navigation Bar Styling */
    
       #nav ul {
    
     text-align: center;
    
          font-size: 11px;
    
          width: 100%;
    
        margin: 0;
    
        padding: 0;
    
        display:inline-block;
    
          padding: 0;
    
          list-style: none;
    
          background-color: #f2f2f2;
    
          border-bottom: 1px solid #ccc;
    
          border-top: 1px solid #ccc; }
    
       #nav li {
    
        display:inline-block;
    
     }
    
       #nav li a
    
     {
    
          display: block;
    
          padding: 8px 15px;
    
          text-decoration: none;
    
          font-weight: bold;
    
          color: #069;
    
          border-right: 1px solid #ccc; }
    
       #nav li a:hover {
    
          color: #c00;
    
          background-color: #fff; }
    
       /* End navigation bar styling. */
    
    
    
    
    
    div {
    
    text-align:center;
    
    }
    
    div#page {
    
        background-color: white;
    
        margin: 0 auto;
    
        text-align: left;
    
        width: 755px;
    
    padding:0px 10px 0 10px;
    
    }
    
    
    
    div#header {
    
      border-bottom:1px solid black;
    
        height: 30px;
    
        line-height: 30px;
    
    }
    
    
    
    div#content {
    
      background: none repeat scroll 0 0 none;
    
      border:0px solid blue;
    
      width:100%;
    
    line-height: 500px;
    
      min-height:500px;
    
        _height:500px
    
    }
    
    
    
    div#footer {
    
      border:0px solid red;
    
        height:30px;
    
        line-height: 30px;
    
      border-top:1px solid black;
    
    font-size: 9pt;
    
    }
    
    
    
    </style>
    
    <body>
    
    
    
    <div id="page">
    
     <div id="header">
    
    
    
    <div style="float: left;">Welcome Admin</div>
    
    <div style="float: right;">LOGOUT</div>
    
       <div id="nav">
    
    
    
       <ul id="nav">
    
          <li><a href="#">Home Page</a></li>
    
          <li><a href="#">My Account</a></li>
    
          <li><a href="#">Update Profile</a></li>
    
          <li><a href="#">Change Avatar</a></li>
    
          <li><a href="#">Change Password</a></li>
    
          <li><a href="#">Support</a></li>
    
    
    
       </ul>
    
    </div>
    
    </div>
    
     <div id="content">Content</div>
    
     <div id="footer"><div style="float: right;">copyright 2014</div></div>
    
    </div>
    
    
    
    
    
    </body>
    
                                
    
                                
    
                               
  6. Hey guys, I am having trouble centering a navbar with css on my template.

     

     

    Here is a jsfiddle live preview for you.

     

    http://jsfiddle.net/LRS38/

     

    I added text-align:center; to it but it still wont center. I also added a margin:0 auto; but no luck.

     

    Can anyone see what I am doing wrong?

    	<div id="navigation">
    		<ul>
    			<li><a href="#">Home</a></li>
    			<li><a href="#">About</a></li>
    			<li class="current"><a href="#">Services</a></li>
    			<li><a href="#">Contact us</a></li>
    		</ul>
    	</div>
    

    and

    #navigation {
    text-align:center;
    background-color:#ef6b51;
    overflow:hidden;
    }
    
  7. Hey guys I have a table with a date selector that I am trying to add a current date option UNLESS there are rows already present with that date.

     

    Here is how it looks:

    K66gtHS.png

     

    Today is the 25th yet it shows the date for the 20th since there are rows present with the 07/20/2013 date in it. How would I do it so it shows the current date?

     

    <div class="lookup">
    <form action="index.php" method="get">
    <select name="exam_date" ONCHANGE="location = this.options[this.selectedIndex].value;" id="type" class="neutral">
    
    <?php 
    $sql_gdate = "SELECT distinct pat_date from patients ORDER BY pat_date DESC";
    $result_gdate = mysql_query($sql_gdate);
    while($row_gdate= mysql_fetch_assoc($result_gdate)){
        
    echo '<option value="?exam_date=' . $row_gdate['pat_date'] . '"';
    
       IF ($exam_date == $row_gdate['pat_date']) {
            echo 'selected="selected"';
        }
        else {
        echo '';
        }
    
    echo '>' . $row_gdate['pat_date'] . '</option>';
    
    
    
    
    }
    ?>
    
    </select>
    </form> 
    </div>
    
  8.  

    I appreciate the help, I have added the code to this query but it throws off errors:

    $result = mysql_query('
    SELECT
        pat_id AS `ID`,
        concat(pat_lname, ', ', pat_fname) as `Full Name`,
        pat_date as `IME Date`,
        office_name as `Location`,
        ins_name as `Insurance Company`,
        pat_show as `Show(Y/N)`
    FROM patients
    INNER JOIN offices ON office_id = pat_loc
    INNER JOIN insurance ON ins_id = pat_ins
    ');
    
    
    						
  9. Hey guys, how would I combine 2 columns into one specifically the first and last name? so its wellens, brian in one box.
    Like this: gfURMCf.png

    Right now I have it as:

    67h0Uzu.png

    This is the code I am using

    
    
    <?php
     
    include_once "config.php";
     
    $result = mysql_query('
        SELECT
            pat_id AS `ID`,
            pat_lname as `Last Name`,
            pat_fname as `First Name`,
            pat_date as `IME Date`,
            office_name as `Location`,
            ins_name as `Insurance Company`,
            pat_show as `Show(Y/N)`
        FROM patients
        INNER JOIN offices ON office_id = pat_loc
        INNER JOIN insurance ON ins_id = pat_ins
    ');
    
    $csv_output = '';
    $headersPrinted = false;
    while ($patient = mysql_fetch_assoc($result))
    {
        if (!$headersPrinted)
        {
            $csv_output .= implode(',', array_keys($patient))."\n";
            $headersPrinted = true;
        }
    
        $csv_output .= implode(',', array_values($patient))."\n";
    }
     
    $filename = $file . "_" . date("d-m-Y_H-i", time());
     
    header("Content-type: application/vnd.ms-excel");
    header("Content-disposition: csv" . date("Y-m-d") . ".csv");
    header("Content-disposition: filename=" . $filename . ".csv");
     
    print $csv_output;
    exit;
    
    ?>
    
    
    

    except do not know how to combine 2 parts into one, the line 8 and line 9

  10. I made this query so it combines 2 tables into one so It can get the name of the office and insurance company instead of the number variable it is but its not working.
     

    $values = mysql_query("SELECT pat_id,pat_lname,pat_fname,pat_date,pat_loc,pat_ins,pat_show FROM patients INNER JOIN offices ON office_id = pat_loc INNER JOIN insurance ON ins_id = pat_ins ");

    How the offices database looks like:
    dsRCYEn.png
     
    How it looks when exporting:
    4zahBq3.png
     
    I am trying to get it to show the name Hackensack instead of a 2 for the location in pat_loc when it exports. How can I get that to work?

    Here is the whole statement:
     

    $values = mysql_query("SELECT pat_id,pat_lname,pat_fname,pat_date,pat_loc,pat_ins,pat_show FROM patients INNER JOIN offices ON office_id = pat_loc INNER JOIN insurance ON ins_id = pat_ins ");
    
    
    while ($rowr = mysql_fetch_row($values)) {
        for ($j = 0; $j < $i; $j++) {
            $csv_output .= $rowr[$j] . ", ";
        }
        $csv_output .= "\n";
    } 
    
  11. I managed to fix that too by changing it into

    $values = mysql_query("SELECT pat_id,pat_lname,pat_fname,pat_date,pat_loc,pat_ins,pat_show FROM " . $table . "");
    

    but one last thing I am stuck on is making it so it shows the name of the number in the offices table that is stored as a number in the patients table as pat_ins and pat_loc

     

    I did:

    $values = mysql_query("SELECT pat_id,pat_lname,pat_fname,pat_date,pat_loc,pat_ins,pat_show FROM patients INNER JOIN offices ON office_id = pat_loc INNER JOIN insurance ON ins_id = pat_ins ");
    

    Could someone show me the problem?

     

    Here is how the offices table looks like

    dsRCYEn.png

  12. I managed to figure out that part:
     

    $result = mysql_query("SHOW COLUMNS FROM " . $table . ""); 
    
    
    $i      = 0;
    
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            //$csv_output .= $row['Field'] . ",";
            $csv_output = "IME Date, Location, patientLast, Firstname, IMEcompany, Show Y/N, Billed";
            $i++;
        }
    }
    

    Now how do I rearange around the second part where it lists the rows, I would like the column Last Name to come before First Name and Location to come after IME Date.

     

    This is the part that gets the rows:

    $csv_output .= "\n";
    $values = mysql_query("SELECT * FROM " . $table . "");
    
    while ($rowr = mysql_fetch_row($values)) {
        for ($j = 0; $j < $i; $j++) {
            $csv_output .= $rowr[$j] . ", ";
        }
        $csv_output .= "\n";
    }
    

    Can I change $rowr[$j] to instead look like $rowr['pat_name'] and list in order the way I want the rows to look like.

    Where would I put the

  13. Hey guys I am trying to export a csv in my script and it works perfectly. Now what I need to do, is rename the columns to clean names and proper names before fully exporting the csv.

     

    Here is a picture of the database table: aQrOZLk.png

     

     

    Here is the code:

    <?php
    
    include_once "config.php";
    
    $table = 'patients'; // table you want to export
    $file  = 'export'; // csv name.
    
    $result = mysql_query("SHOW COLUMNS FROM " . $table . ""); 
    $i      = 0;
    
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            $csv_output .= $row['Field'] . ",";
            $i++;
        }
    }
    $csv_output .= "\n";
    $values = mysql_query("SELECT * FROM " . $table . "");
    
    while ($rowr = mysql_fetch_row($values)) {
        for ($j = 0; $j < $i; $j++) {
            $csv_output .= $rowr[$j] . ", ";
        }
        $csv_output .= "\n";
    }
    
    $filename = $file . "_" . date("d-m-Y_H-i", time());
    
    header("Content-type: application/vnd.ms-excel");
    header("Content-disposition: csv" . date("Y-m-d") . ".csv");
    header("Content-disposition: filename=" . $filename . ".csv");
    
    print $csv_output;
    exit;
    ?>
    
    
    As you can see it fetches the table names from this code:

     

    $result = mysql_query("SHOW COLUMNS FROM " . $table . ""); 
    $i      = 0;
    
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            $csv_output .= $row['Field'] . ",";
            $i++;
        }
    }
    
     

    Now what I am trying to do is allow it to rename the database tables from

    pat_id to Patient ID

    pat_fname to Patient First Name

    pat_lname to Patient Last name

    and so on. To make it looks neat and readable in the csv file.

     

    How am I able to do that? I already tried a few codes like:

    $query = 'SHOW COLUMNS pat_id AS "user_id", pat_fname AS "first name", pat_lname AS "last name" FROM ' . $table;
    But it didnt work and gives off errors.

     

    Could someone with some knowledge help me out please.

  14. That seems to show another error:

     

     

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/briancqc/public_html/export.php on line 15

    Warning: Cannot modify header information - headers already sent by (output started at /home/briancqc/public_html/export.php:15) in /home/briancqc/public_html/export.php on line 33

    Warning: Cannot modify header information - headers already sent by (output started at /home/briancqc/public_html/export.php:15) in /home/briancqc/public_html/export.php on line 34

    Warning: Cannot modify header information - headers already sent by (output started at /home/briancqc/public_html/export.php:15) in /home/briancqc/public_html/export.php on line 35

     

    The current code looks like:

    <?php
    
    include_once "config.php";
    
    $table = 'patients'; // table you want to export
    $file  = 'export'; // csv name.
    
    
    $query = 'SHOW COLUMNS pat_id AS "user_id", pat_fname AS "first name", pat_lname AS "last name" FROM ' . $table;
    
    $result = mysql_query($query);
    
    $i      = 0;
    
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            $csv_output .= $row['Field'] . ",";
            $i++;
        }
    }
    $csv_output .= "\n";
    $values = mysql_query("SELECT * FROM " . $table . "");
    
    while ($rowr = mysql_fetch_row($values)) {
        for ($j = 0; $j < $i; $j++) {
            $csv_output .= $rowr[$j] . ", ";
        }
        $csv_output .= "\n";
    }
    
    $filename = $file . "_" . date("d-m-Y_H-i", time());
    
    header("Content-type: application/vnd.ms-excel");
    header("Content-disposition: csv" . date("Y-m-d") . ".csv");
    header("Content-disposition: filename=" . $filename . ".csv");
    
    print $csv_output;
    exit;
    ?>
    
    
  15. I, personally, would rename the columns - using pat_ in the patient table is 'rendundant' as we already know that is the patient table, so any data coming from there doesn't need pat_ in the name, that would allow you to use up to 64 characters for the column names. (use underscore rather than spaces in the names)

     

    I would then have to edit about 5 other scripts that are part of the system thats why I just want to rename it, that is the only time I need it to be neat and nice, just for the exporting of the csv.

    $result = mysql_query("SHOW COLUMNS pat_id AS "user_id", pat_fname AS "first name", pat_lname AS "last name" FROM " . $table . "");
    

    Getting this error:

    Parse error: syntax error, unexpected T_STRING in /home/briancqc/public_html/export.php on line 9

     

  16. The database tables would then have spaces in them and capital and lowercase words. I tried doing
     

    $result = mysql_query("SHOW COLUMNS pat_id AS user_id, pat_fname AS first name, pat_lname AS last name FROM " . $table . "");
    $i      = 0;
    
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            $csv_output .= $row['Field'] . ";";
            $i++;
        }
    }
    

    But that didnt work and instead shows an error:

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/briancqc/public_html/export.php on line 12

     

  17. Perhaps if the names have a pattern ie "pat_ " you could use

    ... regex,

    or

    ... substr

    or

    explode using the underscore, remove the first element from that array, then implode using the underscore

    Sounds good, but what if I want to fully rename it? not just remove the first parts of the column name pat_ins= Insurance Company

  18. just a guess; but try using commas rather than semi-colons to separate your data

    Awesome, that worked perfect! One more thing, how would I renamethe row name titles so they look cleaner in the csv output.

     

    RacGzog.png

     

    Basically the columns, I would like to rename and set in order before downloading:

     

    This part:

    $result = mysql_query("SHOW COLUMNS FROM " . $table . "");
    $i      = 0;
    
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            $csv_output .= $row['Field'] . ",";
            $i++;
        }
    }
    
  19. working on this script but I am having header already sent troubles on lines that allow you to download the csv.

    http://pastebin.com/6bTjBri5

    An error shows:
     

    Warning: Cannot modify header information - headers already sent by (output started at /home/briancqc/public_html/config.php:5) in /home/briancqc/public_html/export.php on line 29

    Warning: Cannot modify header information - headers already sent by (output started at /home/briancqc/public_html/config.php:5) in /home/briancqc/public_html/export.php on line 30

    Warning: Cannot modify header information - headers already sent by (output started at /home/briancqc/public_html/config.php:5) in /home/briancqc/public_html/export.php on line 31

     


    Where would I add a <br> so after every row a new line starts?

    How it looks right now: WJWqywX.png

    It all goes in a constant line for the export of the rows.
     

  20. Here is what my query looks like
     

    <?php
    /* 
            VIEW.PHP
            Displays all data from 'players' table
    */
    
            // get results from database
            $result = mysql_query("SELECT * FROM patients") 
                    or die(mysql_error());  
                    
            // display data in table
            
            echo "<table width='500px' border='1' cellpadding='10'>";
            echo "<tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> <th>Location</th> <th>Insurance</th> <th>Show</th> <th>Modify</th></tr>";
    
            // loop through results of database query, displaying them in the table
    $count = mysql_num_rows($result);
    //$cursor = mysql_fetch_row($cursor); 
    if ($count !== 0) {
    
            while($row = mysql_fetch_array( $result )) {
                    
                    // echo out the contents of each row into a table
                    echo "<tr>";
                    echo '<td>' . $row['pat_id'] . '</td>';
                    echo '<td>' . $row['pat_fname'] . '</td>';
                    echo '<td>' . $row['pat_lname'] . '</td>';
                    
                    //WHERE I ADDED THE NAME OF THE OFFICE TO REPLACE THE NUMBER VALUE
    
      $getval = mysql_query("SELECT office_name FROM offices WHERE office_id = " . $row['pat_id'] . "");   
    $getval_name = mysql_fetch_row($getval);
    
                    echo '<td>' . $getval_name . '</td>';
                    echo '<td>' . $row['pat_ins'] . '</td>';
                    echo '<td>' . $row['pat_show'] . '</td>';
                    echo '<td><a href="edit.php?pat_id=' . $row['pat_id'] . '">Edit</a>/<a href="delete.php?id=' . $row['pat_id'] . '">Delete</a></td>';
                    echo "</tr>"; 
            } 
            echo "</table>";
    }
    
    
    else {
    echo "</table><b><center>NO PATIENTS HAVE SIGNED IN YET</center></b>";
    }
            
    ?>
    
×
×
  • 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.