PHP - View Image.
Hi.
idea: View image from /skins/ folder. The id for the image is taken from mysql DB field called PlayerDefaultSkin So, lets say a user has 240 in the field in database and in /skins/ folder I have image called 240.png What I want is to php read from PlayerDefaultSkin field and view the image from /skins/ Right now I have this: query to update: Code: [Select] `PlayerDefaultSkin` = $data[PlayerDefaultSkin]' and the output code Code: [Select] <img src="skins/<?php echo '$PlayerDefaultSkin' ?>.png"> which simply doesnt work and is probably very wrong. So can anyone help me with this? Similar TutorialsHi Guys, I am trying to use a script that is available on the net to upload an image into a mysql using BLOB. However it wont upload it keep getting Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/theacidf/public_html/attendance/upload.php on line 17 Here is the code... <?php // Connect to database $errmsg = ""; if (! @mysql_connect("localhost","theacidf_admin","password")) { $errmsg = "Cannot connect to database"; } @mysql_select_db("theacidf_attendanc"); // Insert any new image into database if ($_REQUEST[completed] == 1) { move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img"); $instr = fopen("latest.img","rb"); $image = addslashes(fread($instr,filesize("latest.img"))); if (strlen($image) < 149000) { mysql_query ("insert into pix (title, imgdata) values (\"". $_REQUEST[whatsit]. "\", \"". $image. "\")"); } else { $errmsg = "Too large!"; } } // Find out about latest image $gotten = @mysql_query("select * from pix order by pid desc limit 1"); if ($row = @mysql_fetch_assoc($gotten)) { $title = htmlspecialchars($row[title]); $bytes = $row[imgdata]; } else { $errmsg = "There is no image in the database yet"; $title = "no database image available"; // Put up a picture of our training centre $instr = fopen("../images/logo_png.png","rb"); $bytes = fread($instr,filesize("../images/logo_png.png")); } // If this is the image request, send out the image if ($_REQUEST[gim] == 1) { header("Content-type: image/jpeg"); print $bytes; exit (); } ?> <html><head> <title>Upload an image to a database</title> <body bgcolor=white><h2>Here's the latest picture</h2> <font color=red><?= $errmsg ?></font> <center><img src=?gim=1><br> <?= $title ?></center> <hr> <h2>Please upload a new picture and title</h2> <form enctype=multipart/form-data method=post> <input type=hidden name=MAX_FILE_SIZE value=150000> <input type=hidden name=completed value=1> Please choose an image to upload: <input type=file name=imagefile><br> Please enter the title of that pictu <input name=whatsit><br> then: <input type=submit></form><br> <hr> </body> </html> Why wont it run properly? Thanks in advance... S I using.. Hi, I have tried a "Hello.php" to open in my web browser. It throws 404 file not found error. I am using Intranet. How to determine the web server I am using? Thanks. Hello, I need some help modifying some code. I would like to change the layout to show more then currently offered. As of now I have a layout that shows either 3 or 10 images. I tried to change the numbers, but no luck and I can not seem to be able to change to view more. Any help would be great! Code: [Select] // image list $mysqlDataImage = mysql_query( "SELECT * FROM $DB_IMAGE where collectionID=$cat $where ORDER BY $order_by" ); $dataLength = mysql_num_rows( $mysqlDataImage ); $totalImages = $dataLength; //$cat_scrollview = 3; //FORCE SCROLLER if($scrollview == "smaller"){ $cat_scrollview = 0; } //User Override //SWITCH SCROLL LAYOUT BASED ON VIEW : HANDLES COLUMNS, ROWS, PAGES AND SHOW ALL if (($cat_scrollview == 3)||($scrollview == "bigger")){ $PAGE_SIZE = 3; //how many pics per page, all set in html $rowDefault = 1; //row default-changes the most $colDefault = $totalImages/ 1; //columns default use to breakup columns //echo "cols=".$colDefault; //echo "totalimage=".$totalImages; //See getNumberOfRows() $totalPages = $totalImages/$PAGE_SIZE; $cat_scrollview = 3; $scrollview = "bigger"; }else{ $PAGE_SIZE = 10; //how many pics per page, all set in html $rowDefault = 2; //row default-changes the most $colDefault = $totalImages/ 2; //columns default use to breakup columns //echo "cols=".$colDefault; //echo "totalimage=".$totalImages; //See getNumberOfRows() $totalPages = $totalImages/$PAGE_SIZE; $cat_scrollview = 0; $scrollview = "smaller"; } I am new to PHP so please be kind (and explain slowly) Thank you! I'm very new to MVC and I'm trying to figure out how to transition my code and I'm not sure where to place things. It easy to want to just put everything in the view, but I know that doesn't make sense. Can you please guide me on how I should transition the rest of my code for my header? I'm currently using codeigniter. Current View Code: [Select] <?php $page = substr(end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF'])), 0, -4); $title = (array_key_exists($page, $page_names) !== false) ? $page_names[$page]: ''; if (array_key_exists($page, $page_names) !== false) { $title .= " | Jason Biondo"; } $banner_imgs = array('contact.jpg', 'about.jpg', 'tools.jpg', 'portfolio.jpg', 'articles.jpg'); $nav_names = array('Contact', 'About', 'Tools', 'Portfolio', 'Articles'); $gutter_values = array('307', '230', '161', '84', '0'); $alt_page = 'Articles'; foreach($nav_names as $k => $name) { if($page === strtolower($name)) { $g_value = $gutter_values[$k]; } } if(!isset($g_value)) { $g_value = 0; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta http-equiv="content-script-type" content="text/javascript" /> <meta http-equiv="content-style-type" content="text/css" /> <meta http-equiv="content-language" content="en" /> <meta name="description" content="Jason is a serial entrepreneur that builds web applications using advanced programming technologies and unique interface design." /> <meta name="keywords" content="jason , entrepreneur, investors, venture capitalist, angel investor, vc, ventures, private equity, startups, startup community, startup investments, investment network, raise capital, where to find capital, fund raising, venture financing, contact investors, angel fund, angel group, investment strategy, business plan" /> <title><?=$title?></title> <link rel="shortcut icon" type="image/x-icon" href="/assets/img/favicon.ico" /> <link rel="stylesheet" type="text/css" media="screen" href="/css/style.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="./js/jquery.validate.min.js"></script> <script src="./js/jquery.corner.js"></script> <script src="./js/init.js"></script> <?php if (file_exists("./assets/js/pages/${page}.js")) { echo "<script type=\"text/javascript\" src=\"./js/pages/${page}.js\"></script>"; } ?> </head> <body> <div class="header"> <div class="header_container"> <a href="/"> <img class="logo" src="/assets/img/logo.png" alt="Jason" title="Jason" /> </a> <div class="navigation f_right"> <div class="gutter"> <span id="nav_highlight" class="nav_highlight" style="left: <?php echo $g_value; ?>px;"></span> </div> <ul> <?php foreach($nav_names as $k => $name) { if(is_odd($k)) { ?> <li class="pike"></li> <?php } ?> <li> <a id="<?php echo strtolower($name); ?>" <?php echo (($page === strtolower($name)) || ($alt_page === $name)) ? 'class="selected"' : ''; ?> href="/<?php echo ($name === $alt_page) ? '' : strtolower($name); ?>"><?php echo $name; ?></a> </li> <?php if(is_odd($k)) { ?> <li class="pike"></li> <?php } } ?> </ul> </div> </div> </div> <div class="stripe"></div> <div id="content_container" class="content_container"> <div id="banner" class="banner"> <?php foreach($nav_names as $k => $name) { if(($page === strtolower($name)) || ($alt_page === $name)) { ?> <img src="/assets/img/banners/<?php echo $banner_imgs[$k]; ?>" /> <h1><?php echo $name; ?></h1> <?php break; } if($alt_page === $name) { ?> <img src="/assets/img/banners/<?php echo $banner_imgs[$k]; ?>" /> <h1><?php echo $name; ?></h1> <?php } } ?> </div> <div class="banner_stripe"></div> <div class="content"> Current Controller Code: [Select] <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Writing extends CI_Controller { public function index() { $this->load->library('common'); $data['page_names'] = $this->common->page_names(); $data['is_odd'] = $this->common->is_odd(); $this->load->view('includes/header', $data); $this->load->view('writing_view'); $this->load->view('includes/footer'); $this->output->enable_profiler(TRUE); } } hello, is there a simple way to have a full size calendar that shows current month and on each day, it will look into my mysql table and if i have an entry on that day, show the sales field. i have spent days googling, and trying my own and i just cant get anything. if i had a calendar script, i could do the rest, but i cant seem to find it, or make it. Please help! how can i query data from different tables? I've tried so many codes already but it won't work.
Attached Files
Untitled1.png 39.93KB
0 downloads Dera All, SAMPLE TABLE FIELDS AND DATAS: USER PASSWORD ACCNO AMOUNT INTEREST JOE JOE@123 1234 4500.00 250.00 SAM SAM123 5678 12050.00 350.00 RAM RAM987 8521 15698.00 568.00 MARY MARY786 7542 14879.00 567.00 RAJ RAJ876 8531 45622.00 1500.00 FIRST PAGE: USER NAME : RAM PASSWORD : ******** SUBMIT SECOND PAGE: ACCOUNT NO 8521 THIRD PAGE: HI WELCOME RAM UR BALACE AND INTEREST IS BALANCE : 15698.00 INTEREST : 568.00 HI AM NEW TO PHP. I need the code for above page. If the user only authenticate to view his accounts. Others not possible to view the other accounts This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=329855.0 Greetings! I have a problem with frames. 1.Select Course 2. View all course 3. View Paginated I'm having trouble here, I can view already the selected courses from frame #2, what if I want to show it paginated in frame #3. I'm using the POST method. I used link, t but it shows no result. This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=353984.0 Hello im new to php and i cant seems to view my database in my php
<?php include('../connect.php'); $sds=$_SESSION['SESS_FIRST_NAME']; $result = mysql_query("SELECT * FROM paymentdetails WHERE idnumber='$sds'"); while($row = mysql_fetch_array($result)) { echo '<tr class="record">'; echo '<td style="border-left: 1px solid #C1DAD7"><div align="left">'.$row['date'].'</div></td>'; echo '<td><div align="left">'.$row['amount'].'</div></td>'; echo '</tr>'; } ?> </tbody> </table>Here my database im really confuse on what to do CREATE TABLE IF NOT EXISTS `paymentdetails` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idnumber` varchar(30) NOT NULL, `date` varchar(30) NOT NULL, `amount` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `paymentdetails` -- INSERT INTO `paymentdetails` (`id`, `idnumber`, `date`, `amount`) VALUES (1, 'SID-YWU49JU', '2014-08-07', '50000'); Hi coders,
code below are running good, but my problem is i did not get the line echo $row->pof_num + 1; into view "generate_po.php".
since i want that line to get the value and put into input text like below. how and kindly assist.
<input type = "text" name = "num" value = "<?php echo $row->pof_num + 1; ?>"> public function generate_po() { $po_id = $this->input->post('selector'); $data['result'] = $this->public_base_model->generate_po($po_id); if($this->session->userdata('logged_in')) { $session_data = $this->session->userdata('logged_in'); $data['username'] = $session_data['username']; $data['fname'] = $session_data['fname']; $data['userid'] = $session_data['userid']; $this->load->view('generate_po', $data,$this->get_max()); } else { $this->load->view('login'); } } public function get_max() { $query2 = $this->db->query("SELECT pof_num FROM pull_out where pof_num = '8800000582'"); $row = $query2->row(); echo $row->pof_num + 1; // i want this line to put into view. $query2->free_result(); } my firefox won't open up .tpl format im running apache...how can i view that format on my apache please? I have the following code in zend: Code: [Select] $arrErrors=array(); if (!empty($this->post['submit'])) { // Each time theres an error, add an error message to the error array // using the field name as the key. if (empty($this->post['client_name'])) $arrErrors['client_name'] = "Please Enter Client's name as it appears in the carrier software"; } if i set $this->view->arrErrors=$arrErrors in the controller, Can I access it as $this->arrErrors['client_name'] in the view? Hi, I am trying to store the view rate of articles so that I can retrieve them later on by "the most popular". I have searched around but cannot find a straight answer. Can anyone point me towards the right direction? Edit: Never mind, I was over complicating the logic behind this. when i right click to view page source i just saw the javascript calling php as source file , while on page there is table, i need to read that table in database , is there nay way to do that, file_get contents dont work on it its just take javascript not the page table Alright guys i have an idea on what am going to do here, although i am unsure that it's the best way to go about it. I am creating a blog and i need to count how many views an article gets in order to display the top 10 most viewed articles. Here is my plan... 1. Add an additional field to my blog posts table called viewed 2. On the view article page have an update method that adds one to the current number on the the coloum viewed 3. When displaying the 10 most viewed articles query it by the heightest number and limet to 5 by any means is there a way to view a email.php form source? not just the html part but the entire script including the php? |