PHP - Import Data From Table Shown At Screen
Hi all,
I'm developing a website and i need to upload a xml spreadsheet and see data at screen just to verify if it is correct. So far so good. But after the user see the data in the screen, he should be able to import that file to mssql. The problem is, in this second page where i show the data that the XML spreadsheet contains, i don't have the file location to submit the file again. How can i resolve this problem? Any ideas? Thanks in advance. Regards Similar TutorialsI think this is the right section to post this is in..... Anyway.....I'm building a web site that requires i have functionality to upload a tab delimited file (or some file format that is easiest) via php and insert the data into MYSQL. I've searched for many third party scripts but none seem to work. So I've decided to move to the community to see if someone can give me insight on how i might accomplish this script. I have some third party scripts but I'm not sure if they'd be of any use. Thank you kindly help - can you tell me why this is giving the following error
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DROP TABLE IF EXISTS `admin`' at line 8
i am trying to import a data file ... first few lines of which are
-- MySQL dump 10.10 -- -- Host: localhost Database: bromleyone -- ------------------------------------------------------ -- Server version 5.0.22-Debian_0ubuntu6.06.10-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; use bromleyone -- -- Table structure for table `admin` -- DROP TABLE IF EXISTS `admin`; CREATE TABLE `admin` ( `id` int(11) NOT NULL auto_increment, `username` varchar(30) NOT NULL default '', `password` varchar(30) NOT NULL default '', `name` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Hello all. Here is my script... Code: [Select] if (isset($_POST['submit'])) { if (is_uploaded_file($_FILES['filename']['tmp_name'])) { echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "<br></h1>"; echo "<h2>Displaying contents:</h2>"; readfile($_FILES['filename']['tmp_name']); echo "<br>"; echo $headers; } $handle = fopen($_FILES['filename']['tmp_name'], "r"); $header = fgetcsv($handle); while(! feof($handle)){ while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $import="INSERT into CSVtest($header[0],$header[1],$header[2],$header[3],$header[4]) values ('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]')"; mysql_query($import) or die(mysql_error()); } } fclose($handle); echo "Done"; } This is the way how I insert data into database according to header even it's not arranged same as the table column. If the csv has only "cell,firstname,lastname,," (and my table has only these 3 columns as well) then it still working...but if there are "cell,address,company,firstname,lastname" then it will show me unknown column error. Actually I wish to have a function that even there are many columns in csv that not exist in the table it still can just pick the right column and insert into table. Can anyone give me hints on how to change my script?I know there are many errors...it's really embarrassed to show my low standard script... Thanks in advance. Hello, this script originally works by reading a physical copy of 'bans.txt' located in the same directory. How could I get it to read the remote bans.txt located here and parse info from it like the on-site copy? the remote file: http://108.163.211.219/bans.txt Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Data Tables and Cascading Style Sheets Gallery</title> <style>/* Tema: Soft Table - A Simple table style with the use of the soft brown color Author: Newton de G?es Horta Site: -- Country Origin: Brazil */ table { font-size:0.9em; font-family: Arial, Helvetica, verdana sans-serif; background-color:#fff; border-collapse: collapse; width: 100%; } caption { font-size: 25px; color: #1ba6b2; font-weight: bold; text-align: left; background: url(http://www.nghorta.com/csstg/header_bg.jpg) no-repeat top left; padding: 10px; margin-bottom: 2px; } thead th { border-right: 1px solid #fff; color:#fff; text-align:center; padding:2px; text-transform:uppercase; height:25px; background-color: #a3c159; font-weight: normal; } tfoot { color:#1ba6b2; padding:2px; text-transform:uppercase; font-size:1.2em; font-weigth: bold; margin-top:6px; border-top: 6px solid #e9f7f6; } tbody tr { background-color:#fff; border-bottom: 1px solid #f0f0f0; } tbody td { color:#414141; padding:5px; text-align:left; } tbody th { text-align:left; padding:2px; } tbody td a, tbody th a { color:#6C8C37; text-decoration:none; font-weight:normal; display:block; background: transparent url(http://www.nghorta.com/csstg/links_yellow.gif) no-repeat 0% 50%; padding-left:15px; } tbody td a:hover, tbody th a:hover { color:#009193; text-decoration:none; } /* tr:nth-child(even) { background-color: grey; } */ </style></head> <body> <table summary="Submitted table designs"> <thead><tr> <th style="font-size:12px" scope="col"><center>Nickname</center></th> <th style="font-size:12px" scope="col"><center>Admin</center></th> <th style="font-size:12px" scope="col"><center>Banned</center></th> <th style="font-size:12px" scope="col"><center>Reason</center></th> <th style="font-size:12px" scope="col"><center>SteamID</center></th> <th style="font-size:12px" scope="col"><center>Length</center></th> <th style="font-size:12px" scope="col"><center>Status</center></th> </tr></thead> <tbody> <!-- <tr><th scope="row" id="r100"><a href="100.php">rows table template</a></th> <td><a href="http://www.adobati.it">Omar '0m4r' Adobati</a></td><td>Italy</td> <td>Simple, clean and a quite classic table template :)</td> <td><a href="http://www.adobati.it/labs/CSSTable/0m4r.table.css" title="Download the rows table template CSS file">Download</a></td> <td>test</td> <td>test2</td> </tr> --> <?php // Credits to justin as he was able to understand my messy PHP code and do this much better code for me. function buildBanList($arr) { $filename = "bans.txt"; $bans = array(); $tmp_array = array(); // Build Ban Array if (file_exists($filename)) { foreach( $arr as $line ) { if( substr(trim($line), 0, 7) == '"STEAM_' ) { $tmp_array["user_steamid"] = str_replace('"', '', trim($line)); } if( substr(trim($line), 0, 6) == '"time"' ) { $tmp = explode(' ', trim($line)); $tmp_array["user_bantime"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 15) == '"modified_time"' ) { $tmp = explode(' ', trim($line)); $tmp_array["user_modified"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 7) == '"unban"' ) { $tmp = explode(' ', trim($line)); $tmp_array["user_unban"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 7) == '"admin"' ) { $tmp = explode('" "', trim($line)); $tmp2 = explode('(', $tmp[1]); $tmp_array["admin_name"] = str_replace('"', '', $tmp2[0]); } if( substr(trim($line), 0, 6) == '"name"' ) { $tmp = explode('" "', trim($line)); $tmp_array["user_name"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 8) == '"reason"' ) { $tmp = explode('" "', trim($line)); $tmp_array["user_reason"] = str_replace('"', '', $tmp[1]); } // Save ban record to main array once detected end. if( substr(trim($line), 0, 1) == '}' ) { // If console ban then set required fields. if( $tmp_array["admin_name"] == "") $tmp_array["admin_name"] = "Console"; array_push($bans, $tmp_array); $tmp_array = array(); } } } //Sort Array by Ban Date $tmp = array(); foreach($bans as &$ma) $tmp[] = &$ma["user_bantime"]; array_multisort($tmp, SORT_DESC, $bans); return $bans; } //Begin Presentation $file = file("./bans.txt"); date_default_timezone_set("Europe/London"); $bans = buildBanList($file); foreach ($bans as $ban) { echo '<tr> '; // Output if ($ban["user_name"] != '') echo '<td style="text-align:center; font-size: 12px">'.$ban["user_name"].'</td><td style="text-align:center; font-size: 12px" class="admin">'; else echo '<td style="text-align:center; font-size: 12px"><span style="color:#FF0000">N/A</span></td><td style="text-align:center; font-size: 12px" class="admin">'; echo $ban["admin_name"].'</td><td style="text-align:center; font-size: 12px">'.date('H:i - d/m/y',$ban["user_bantime"]).'</td>'; /* Unban date. if ($ban["user_unban"] != "0") { echo date('H:i - d/m/y',$ban["user_unban"]); } else { echo "Never"; }*/ echo '<td style="text-align:left; font-size: 11px">'.$ban["user_reason"].'</td>'; // Status $today = strtotime("now"); echo '</td><td style="text-align:center; font-size: 12px">'.$ban["user_steamid"].' </td>'; // Ban Length $date1 = date('y-m-d H:i:s',$ban["user_bantime"]); $date2 = date('y-m-d H:i:s',$ban["user_unban"]); $to_time=strtotime($date1); $from_time=strtotime($date2); $ban_length = round(abs($to_time - $from_time) / 60,0); if ($ban["user_unban"] != "0") { // Days if ($ban_length >= 1440) { $ban_length = round(abs($to_time - $from_time) / 24 / 60 / 60,0); // Years couldn't be arsed to think of another way to do it. if ( $ban_length >= 365 ) { $ban_length = round(abs($to_time - $from_time) / 360 / 24 / 60 / 60,0); if ($bans_length > 1) echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Years </td>"; else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Year </td>"; } else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Days </td>"; } // Hours else if ($bans_length >= 60) { $ban_length = round(abs($to_time - $from_time) / 60 / 60,0); if ($bans_length > 1) echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Hours </td>"; else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Hour </td>"; } else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Minutes </td>"; } else { echo "<td style=\"text-align:center; font-size: 12px\">Permanent</td>"; } if ($ban["user_unban"] == "0") echo '<td style="text-align:center; font-size: 12px"><span style="color:#FF0000">Banned</span></td>'; else if ( $today > $ban["user_unban"] ) echo '<td style="text-align:center; font-size: 12px"><span style="color:#008000">Expired</span></td>'; else echo '<td style="text-align:center; font-size: 12px"><span style="color:#FF0000">Banned</span></td>'; echo '</tr>'; } ?></table> <center><p>Web-based ULX bans by Russy.</p></center> </div> </body> </html> I've tried experimenting w/ stuff like Code: [Select] $filename = "http://108.163.211.219/bans.txt"; $contents = file_get_contents($filename); but it doesn't seem to want to work. Howdy - good evening dear PHP-Friends, i am new to programming. I have a couple of (hundred) adress( and data ) lines that look like the following: {'url': 'http://Url.org/~dilbert/', 'cname': 'dibert_1', 'name': 'Dilbert_1', 'email': 'dilbert_1@ncf.ca'} {'url': 'http://Url.org/~dilbertwo/', 'cname': 'dilbert_2', 'name': 'Dilbert_2', 'email': 'dilbert_2@hotmail.com'} {'url': 'http://Url.org/~dilberthree/', 'cname': 'dilbert_3', 'name': ' Dilbert_3', 'email': 'dilbert_3@gmail.com'} and so forth.... Well - i want to put the data into the Thnderbird-Adressbook: But the adressbook does not take the data in this format. So what can i do with the data-set. How to Manipulate!? Note: At least a name and a E-Mail-Adress is needed. Nothing more - but - a Mail - Adress is pretty important. i look forward to hear from you if you have any further questions - jus t lemme know! This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=330652.0 I need some help getting started in writing the php code that would import a text file of name/value pairs and then create an html table with those values. The datafile looks something like this: [number]-[attribute]=[value]; 1-Host=server1.abc.dev.jkl;2-Date=Wed Aug 12 2010;3-Set=abc.123.cde;4-Time=01:00:03;5-Length=00:36:09;6-Size=41.54 GB;7-Status=Succeeded; 1-Host=server2.abc.dev.qrs;2-Date=Wed Aug 12 2010;3-Set=gls202.kul_lvm;5-Length=06:20:33;7-Status=Succeeded; 1-Host=server9.mra.dev.xyz;2-Date=Wed Aug 11 2010;3-Set=gls101.aie_lvm;4-Time=01:00:02; Let's say I have an html table: Code: [Select] <table id="stats"> tr> <th>Host</th> <th>Date</th> <th>Set</th> <th>Time</th> <th>Length</th> <th>Size</th> <th>Status</th> </tr> <tr> <td>server1.abc.dev.jkl</td> <td>Wed Aug 12 2010</td> <td>abc.123.cde</td> <td>01:00:03</td> <td>00:36:09</td> <td>41.54 GB</td> <td>Succeeded</td> </tr> </table> I've looked around all day at various samples. I've seen the fgetcsv function. I'm not sure what would be the best approach to load this into data into a table. Using a regex, then load into array or hash and then print this out? I'm assuming i would have to create print statements to produce the html tags. Also, with the sample records I provided. There will be instances where not all the attributes (1-7) have values. So, i'm envisioning empty cells for that record which is fine. I can also change the way the datafile is generated and remove the [number], so its just [attribute]=[value] if that makes it easier. Is there a good mapping technique for this? Thank you for your help. I'm have trouble getting my script to show images in a table across the screen. I want to show the picture and have the description shown below it. Right now it shows it in a column with the name next to it. Any help would be greatly appreciated. Thanks in advance. Below is the script. <?php include 'config1.php'; // Connect to server and select database. mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect"); mysql_select_db("vetman")or die("cannot select DB"); $result = mysql_query("SELECT * FROM $dbname WHERE year = '1954'") or die(mysql_error()); // store the record of the "" table into $row //$current = ''; // keeps getting the next row until there are no more to get if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; echo "<table>"; echo "<br>"; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; echo "<td align=center>"; ?> <div> <a><img src="<?php echo $tn; ?>"</a><a><?php echo $title; ?></a></div> <?php echo "</td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i > 0) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; echo '</tr>'; } mysql_close(); ?> </table> Hello to all, I have problem figuring out how to properly display data fetched from MySQL database in a HTML table. In the below example I am using two while loops, where the second one is nested inside first one, that check two different expressions fetching data from tables found in a MySQL database. The second expression compares the two tables IDs and after their match it displays the email of the account holder in each column in the HTML table. The main problem is that the 'email' row is displayed properly while its while expression is not nested and alone(meaning the other data is omitted or commented out), but either nested or neighbored to the first while loop, it is displayed horizontally and the other data ('validity', 'valid_from', 'valid_to') is not displayed.'
Can someone help me on this, I guess the problem lies in the while loop? <thead> <tr> <th data-column-id="id" data-type="numeric">ID</th> <th data-column-id="email">Subscriber's Email</th> <th data-column-id="validity">Validity</th> <th data-column-id="valid_from">Valid From</th> <th data-column-id="valid_to">Valid To</th> </tr> </thead> Here is part of the PHP code:
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ' <tr> <td>'.$row["id"].'</td> '; while ($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)) { echo ' <td>'.$row1["email"].'</td> '; } if($row["validity"] == 1) { echo '<td>'.$row["validity"].' month</td>'; }else{ echo '<td>'.$row["validity"].' months</td>'; } echo ' <td>'.$row["valid_from"].'</td> <td>'.$row["valid_to"].'</td> </tr>'; } ?>
Thank you. I can add and delete data from my table. Now I need to be able to change one or more fields in an entry. So I want to retrieve a row from the db, display that data on a form where the user can change any field and then pass the changed data to an update.php program. I know how to go from form to php. But how do I pass the data from retrieve.php to a form so it will display? Do I use a URL and Get? Can I put the retrieve and form in the same program? Hey everyone. I am creating a website so my family can select from the list of present my daugther has asked for. I have them logging in, and that works. I have the table data set and the search and table display works. But I would like to display the list (as in the code below) but with a checkbox in the first column (add a column). From that the authenticated user can click on the item they have purchased and that selection will be moved to another table (called purchased). I have that code. The only thing I cannot figure out is to present the data in list form with a checkbox (like you would see on an order form). Here is the display code (there is no error checking at this point): <head><LINK REL="SHORTCUT ICON" HREF="cmwschl.ico"></head> <body bgcolor="#C0C0C0"> <font face="Arial" color="#000080">Books from the Selected Series</font> </h1> <hr font color="Navy" font size="3"> <center> <table border="1" cellpadding="5" cellspacing="0" bordercolor="#000000"> <tr> <td width="170" bgcolor="#FFCC66"><center><b><font color="navy" size="2" face="Trebuchet MS"><b><center>Book Number</center></font></b></center></td> <td width="140" bgcolor="#FFCC66"><center><b><font color="navy" size="2" face="Trebuchet MS"><b><center>Book Group</center></font></b></center></td> <td width="100" bgcolor="#FFCC66"><center><b><font color="navy" size="2" face="Trebuchet MS"><b><center>Book Title</center></font></b></center></td> </tr> <?php $con = mysql_connect("localhost","twilson","R00tb33r!") or die('Connection: ' . mysql_error());; mysql_select_db("CMWWeb", $con) or die('Database: ' . mysql_error()); ?> <? $group = $_POST['bookgrp']; //if ($Prod <> 0) { $sql = "SELECT * FROM `OpenBooks` WHERE `bookgrp`= '$group'"; $results = mysql_query($sql); if ($results) { //this will check if the query failed or not if (mysql_num_rows($results) > 0) { //this will check if results were returned while($copy = mysql_fetch_array($results)) { $variable1=$copy['booknum']; $variable2=$copy['bookgrp']; $variable3=$copy['booktitle']; //table layout for results print ("<tr>"); print ("<td><center>$variable1</center></td>"); print ("<td><center>$variable2</center></td>"); print ("<td><left>$variable3</left></td>"); print ("</tr>"); } } else { echo "No results returned"; } } else { echo "Query error: ".mysql_error(); } mysql_close($con); ?> </table> </center> hello friends I'm dealing with this problem for two days. I put here the screenshot for easier understanding.Sorry about my bad english. Here is the ss http://i61.tinypic.com/2rz5q55.jpg I don't want to inner join or table join. All image links which same sku should displayed in single row where products.resimler colon I can join the tables but i want to one table.Because i can import single csv file for e-commerce script.How can I use a update query for list multiple images in table products. Edited by nogai, 10 October 2014 - 07:01 AM. the second database found on the cloud
i try to get JSON data but how to insert and update them to another online database with the same table my php script to return json data <?php include_once('db.php'); $users = array(); $users_data = $db -> prepare('SELECT id, username FROM users'); $users_data -> execute(); while($fetched = $users_data->fetch()) { $users[$fetchedt['id']] = array ( 'id' => $fetched['id'], 'username' => $fetched['name'] ); } echo json_encode($leaders);
i get
{"1":{"id":1,"username":"jeremia"},"2":{"id":2,"username":"Ernest"}} Edited March 24 by mahenda Hello all , I am facing a problem when trying to to show image files generated from php code in IE8 . it is working fine on firefox and IE9 . but in IE8 its showing the famous red X instead of the image ; belw is the code: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html dir="RTL" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" lang="en-us" > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <head> <title>header </title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <?php mb_internal_encoding('UTF-8'); /** * @author IT Department * @copyright 2011 */ INCLUDE ("header.php"); INCLUDE ("connect.php"); if (isset($_GET['id'])) { $ID=$_GET['id']; $sql="select employees.USER_ID, employees.NAME_ARAB, employees.NAME_ENG, employees.TITLE_ARAB, employees.TITLE_ENG, department.DEP_NAME_ENG, department.DEP_NAME_ARAB, location.LOC_DESC_ENG, location.LOC_DESC_ARAB, employees.MOBILE, employees.EMAIL, employees.DEP, employees.LOC FROM employees,location,department WHERE employees.DEP=department.DEP_ID AND employees.LOC=location.LOC_ID and employees.USER_ID=$ID "; //echo $sql; $result=mysql_query($sql,$link); mysql_query("SET NAMES 'utf8'"); ECHO '<html DIR="RTL">'; echo "<table width=100% border='1' cellpadding='8' align='center' bgcolor='white'>"; while ($row = mysql_fetch_array($result, MYSQL_NUM)) { //$row = mysql_fetch_assoc($result); echo"<tr align='center'>"; echo"<td>"; ECHO " الرقم الوظيفي :"; echo"</td>"; echo"<td colspan='2'>"; ECHO "<strong>$row[0]</strong>"; echo"</td>"; echo"<td>"; ECHO " : User ID "; echo"</td>"; echo"<td rowspan='7'>"; ECHO "<img src='IMAGE.php?id=".$row[0]."' width='225' height='300'/>"; //the image echo"</td>"; echo "</tr>"; the php image file is : Code: [Select] <?php INCLUDE ("connect.php"); $ID = "'".$_GET['id']."'"; $sql="SELECT PHOTO FROM employees WHERE USER_ID=$ID"; $result=mysql_query($sql,$link); $row = mysql_fetch_array($result); header("Content-type: image/pjpeg"); print ( $row[0]); ?> Thanks in advance for your help hi, i have the code below where it shows the images in connection with a reference. in my img table i only have two rows but the code below keeps showing it 7 times can you please help me? <table width=200> <div id="wrapper"> <!-- Content area --> <div id="content"> <!-- We will be working inside these tags --> <div id="gallery"> <?php $images=mysql_query("SELECT img.id, img.refimage, img.image, img.thumb, users.users_id FROM img, users WHERE img.refimage='$ref' AND users_id='$user_id'"); echo '<table width="40">'; while($row = mysql_fetch_array($images)) { $image=$row['image']; $thumb=$row['thumb']; echo '<div class="image_container">'; echo "<a href='$image' rel='lightbox[roadtrip]'><img src= '$thumb' width='60' height='40' alt='$title'>"; echo '</a></div>'; } ?> </div> <!-- We will be working inside these tags --> </div> </div> </table></td> Here is the User profile search form... when i search that all details comes without Employee's Photo.. What's the error ? Code: [Select] </head> <body> <?php $uname = $_POST['uname']; $sql = "SELECT * FROM emp WHERE uname = '$uname'"; $result = mysql_query($sql); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $fname = $row['fname']; $lname = $row['lname']; $email = $row['email']; $address = $row['address_1']; $address2= $row['address_2']; $address3= $row['address_3']; $image = $row['image']; $gender=$row['gender']; $mobile=$row['tp_mobile']; $land=$row['tp_lnd']; $bod=$row['bod']; } } ?> <div class="main"> <div class="header"> <div class="header_resize"> <div class="logo"><h1></h1></div> <div class="clr"></div> <div class="search"> <form id="form1" name="form1" method="post" action="emp_profile.php"> <span> <input name="uname" type="text" class="keywords" id="textfield" maxlength="50" /> </span> <input name="image" type="image" src="images/search.gif" class="button" /> </form> </div> <div class="menu"> <ul> <!-- <li><a href="index.html" class="active">Home</a></li> <li><a href="services.html">Services</a></li> <li><a href="about.html"> About Us </a></li> <li><a href="contact.html"> Contact Us</a></li> --> </ul> </div> </div> <div class="clr"></div> </div> <div class="clr"></div> <div class="body"> <div class="body_resize"> <form id="" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" accept-charset='UTF-8'> <div id="container"> <fieldset > <div id="content-container1"> <div id="content-container2"> <div id="section-navigation"> <img align="top" width="175" height="200" src="emp_images/<?php echo $image; ?>"/> <div> <!-- <label>Patient Name : </label> --> <br /> </div> </div> <div id="content" align="justify"> <h2> <label for="fname"> <?php echo $fname; ?></label> <label for="lname"> <?php echo $lname; ?></label> </h2> <p> <label><b>Email:</b></label> <br /> <label for="email"> <?php echo $email; ?></label> </p> <p> <label><b>Employee Address:</b></label> <br /> <label > <?php echo $address; ?></label> </p> <p> <label><b>Employee Address 2:</b></label> <br /> <label > <?php echo $address2; ?></label> <p> <label><b>Employee Address 3:</b></label> <br /> <label > <?php echo $address3; ?></label> <p> <label><b>Gender:</b></label> <br /> <label > <?php echo $gender ?></label> </p> <p> <label><b>Employees Mobile:</b></label> <br /> <label > <?php echo $mobile ?></label> </p> <p> <label><b>Employees Resident Number:</b></label> <br /> <label > <?php echo $land ?></label> </p> <p> <label><b>Date of Birth:</b></label> <br /> <label > <?php echo $bod ?></label> </p> </div> </div> </fieldset> <div class="clr"></div> </div> </div> </form> <div class="footer"> <div class="footer_resize"> <p>© P2011-001</p> </div> <div class="clr"></div> </div> </div> </div> </div> </body> </html> <?php mysql_close($con); ?> So. I'm using this code right he <?php $imagepath = "css/images/statspage.jpg"; $image = imagecreatefromjpeg($imagepath); $imgheight = imagesy($image); $color = imagecolorallocate($image, 255, 255, 255); imagestring($image, 5, 70, $imgheight-50, "This is a test", $color); header('Content-Type: image/jpeg'); imagejpeg($image); ?> It works like it should. Now my problem is, is that the image is being displayed at a very low quality! Here's the original image: Here's the image with the code above: RIGHT away you can tell the HUGE difference. I'm not sure what I'm doing wrong. Maybe i need a higher res image? If y'all guys know a different method THAT also achieves the same thing I'm trying to do. Please let me know ASAP! Hi there i wanted to know how i could rule out certain rows from being shown in the pagination in this case i want to approve all information before it's posted i tried $sql = "SELECT * FROM tablename LIMIT $offset, $rowsperpage WHERE approved = 'Yes'"; But it didnt work Any help would be great, Thanks, Blink359 Hi all I am describing my problem below can any body please look into this I have two databases DB1:datain1 DB2:datain2 having the below structure database, table, fields datain1 , student , id,name datain2 , student , id,name the two databases having same structure My query is i want copy all data from datain1 to datain2 on daily process through php script(script will be executed manually on daily) i don't want any duplicate or repeated data in datain2 give me some script to do this kindly help me to solve this its so urgent What im trying to do is make a mysql result appear on my screen like this result 1 result 2 result 3 result 4 result 5 result 6 result 7 result 8 result 9 i will be using the query like mysql_query("SELECT * FROM `cars` ORDER BY `id`"); so how will i get it to display like that thanks |