PHP - What To De Next As I Cannot View My Hello.php In Browser?
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. Similar TutorialsHey, I am pretty new to php. I am creating a simple website to handle a http get I need to do for a Android Application. I can write to a file but I am unable to open it in a browser. It just shows a blank page. When I download it from my browser (Firefox) to my hard drive (Windows 7) using my ftp I can view the .txt file. All i want to do is write to a text file. Any help would be nice. Sorry for sparse information. I am hosting it on 000webhost.com. Thanks My Code: 3 files blank "data.txt", index.html, process.php Index.html Code: [Select] <html><body> <h4>Tizag Art Supply Order Form</h4> <form action="process.php" method="post"> <select name="item"> <option>Paint</option> <option>Brushes</option> <option>Erasers</option> </select> Quantity: <input name="quantity" type="text" /> <input type="submit" /> </form> </body></html> process.php <html><body> <?php $quantity = $_POST['quantity']; $item = $_POST['item']; $myFile = "data.txt"; $fh = fopen($myFile, 'at') or die("can't open file"); $stringData = "Bobby Bopper"; fwrite($fh, $stringData); $stringData = "Tracy Tanner"; fwrite($fh, $stringData); fclose($fh); echo "You ordered ". $quantity . " " . $item . ".<br />"; echo "Thank you for ordering from Tizag Art Supplies!"; ?> </body></html> 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! 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 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. 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? 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 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); } } I'd like to use an application that's not browser based, on Internet Explorer. I've read somewhere that this is possible with a PHP script, but which one? If you can get me on the right track, I'd really appreciate it. Cheers. 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 all. How can i see all the difference between two dates in a column. I know to see a single date difference we can do: $stmt = $pdo->query("SELECT DATEDIFF(date_paid, next_due) AS diffdate FROM table_name"); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo $row['diffdate']; } but i want all the difference to show in a table along with other details. thanks Hope this is clear and concise! I have a view article page and every time you land on the page then I have a query that runs an update using sql. Now the problem is everytime the script is run it counts one hit as 2. For example if an article has been viewed 4 times. Next time you land on the page it shows the page has been seen 6 times instead of 5. Here is my code below for the view_article page: Code: [Select] <body bgcolor="#000000"> <div id="site_div" align="center"> <div id="wrapper_div"> <!-- header --> <?php include 'header.php'; ?> <!-- header --> <div id="main_nav"> <div id="link1_div"><p class="link1_class"><a href="index.html" class="link1_class">All Articles</a></p></div> <div id="link2_div"><p class="link2_class"><a href="index.html" class="link2_class">Reviews</a></p></div> <div id="link3_div"><p class="link2_class"><a href="index.html" class="link2_class">Previews</a></p></div> <div id="link4_div"><p class="link2_class"><a href="buys.php?lightbox[width]=700&lightbox[height]=400&lightbox[modal]=true" class="link2_class lightbox">Videos</a></p></div> <div id="link5_div"><p class="link2_class"><a href="rents.php?lightbox[width]=700&lightbox[height]=400&lightbox[modal]=true" class="link2_class lightbox">News</a></p></div> <div id="link6_div"><p class="link2_class"><a href="index.html" class="link2_class">Podcasts</a></p></div> <div id="link7_div"><p class="link2_class"><a href="index.html" class="link2_class">Contact Us</a></p></div> <div id="link8_div"><p class="link2_class"><a href="index.html" class="link2_class"></a></p></div> </div> <div id="sub_nav"> <div id="sub_nav_div"> <p class="filter_by_class">FILTER BY: <a href="index.php" style="color:#21a8f7; text-decoration:underline">All</a> <a href="xbox360.php">Xbox 360</a> <a href="#">PS3</a> <a href="#">Wii</a> <a href="#">PC</a> <a href="#">PSP</a> <a href="#">DS</a><a href="#">Mobile</a><a href="#">Older Platforms</a></p></div> </div> </div> <div id="content_div"> <div id="content_spacer"> </div> <!-- TRACK PAGE <span class="posthilit">VIEWS</span> --> <?php //DATABASE CONNECTION include_once 'dbc.php'; $id = $_GET['id']; mysql_query("UPDATE articles SET `article_views` = `article_views`+1 WHERE idarticles='$id'"); ?> // TrACK PAGE <span class="posthilit">VIEWS</span> // MAIN CONTENT if(isset($_GET['id']) && is_numeric($_GET['id']) ) { $query = "SELECT * FROM articles WHERE idarticles= {$_GET['id']}"; if($r = mysql_query($query)) { $row = mysql_fetch_array($r); echo " <div id=\"main_article_div\"> <div id=\"top_blue_content_div\"> {$row['article_type']}</div> <div id=\"image_main_content_div\"><img src=\"{$row['article_big_image']}\" width=\"200\" height=\"112\" alt=\"main_article_image\" /></div> <div id=\"content_area\"><p class=\"main_content_title_class\">{$row['article_title']} <div id=\"addthisspacer\"> <!-- AddThis Button BEGIN --> <div class=\"addthis_toolbox addthis_default_style \"> <a class=\"addthis_button_facebook_like\" fb:like:layout=\"button_count\"></a> <a class=\"addthis_button_tweet\"></a> <a class=\"addthis_counter addthis_pill_style\"></a> </div> <script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4d1d4fb34dc87309\"></script> <!-- AddThis Button END --> </div> </p> </div> </div> "; } } ?> <!-- MAIN CONTENT ENDS --> </div> <div id="lower_content_div"> <!-- THIS IS WHERE THE MAIN ARTICLE/COMMENTS STARTS --> <?php //include 'dbc.php'; if(isset($_GET['id']) && is_numeric($_GET['id']) ) { $query = "SELECT * FROM articles WHERE idarticles= {$_GET['id']}"; if($r = mysql_query($query)) { $row = mysql_fetch_array($r); echo " <div id=\"left_lower_content\" class=\"break-word\"> {$row['actual_article']} </div> "; } } ?> <!-- THIS IS THE END OF THE MAIN ARTICLE/COMMENTS QUERY --> </div> <div id="footer_div"> <div id="footer_1"></div> <div id="actual_footer"> <div id="top_footer_div"> <div id="top_footer_div_left"><a href="login.php?lightbox[width]=396&lightbox[height]=200&lightbox[modal]=true"><img src="images/rent-or-buy-2-logo_small2.png" width="260" height="39" alt="small_logo" class="small_logo_class" /></a></div> <div id="top_footer_div_right"> <div id="login_register_div_2"> <p class="logintext"><a href=""><img src="images/rss_icon.png" width="16" height="16" alt="rss_icon" /></a></p><p class="logintext"><a href="http://www.twitter.com"><img src="images/twitter_icon.png" width="16" height="16" alt="twitter_icon" /></a></p><p class="logintext"><a href="http://www.youtube.com"><img src="images/youtube_icon.png" width="38" height="16" alt="youtube_icon" /></a></p><p class="logintext"><a href="http://www.facebook.com"><img src="images/facebook_icon.png" width="16" height="16" alt="facebook_icon" /></a></p> </div> </div> <div id="search_div2"> <form action="#" method="post" name="search"> <input type="text" value="Search!" class="formimage" /> <INPUT TYPE="IMAGE" src="images/search_bar_button.jpg" BORDER="0" style="padding:0" class="formbutton"> </form> </div> </div> <div id="actual_footer_bottom_section"> <div id="actual_footer_bottom_section_top"></div> <div id="actual_footer_bottom_section_top_links"><a href="index.php">All Articles</a> | <a href="#">Reviews</a> | <a href="#">Previews</a> | <a href="#">"Buys"</a> | <a href="#">"Rents"</a> | <a href="#">Videos</a> | <a href="#">News</a> | <a href="#">Games</a> </div> <div id="actual_footer_bottom_section_bottom"> <p class="actual_footer_bottom_section_paragraph">Design By: Felix Henriques | Created By: Felix Henriques | Copyright 2010 Buy Or Rent Games</p></div> <div id="actual_footer_bottom_section_top"></div> </div> </div> </div> </div> </div> </body> </html> Im trying to make this news blog for my assignment. When user selects a certain blog the blog id is stored in the veriable $blogid. I am using the SELECT FROM WHERE but something is going wrong cos it keeps telling me :Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in F:\xampp\htdocs\Blog\viewBlog.php on line 12. What is the problem and what do i have to change?? This problem is in the second page the View blog page. this is my code: View all page: <html> <body> <?php $dbc = mysqli_connect('localhost','root','','blogdb') or die ('Error: Could not connect to database. Please try again'); $query = "SELECT title, postdatetime, username FROM blog"; //echo "$query"; $result = mysqli_query($dbc, $query); /*echo"<table border=1>"; echo "<tr> <th> Title</th> <th> Postdatetime</th> <th> Posted by :</th> </tr>"; */ while($row = mysqli_fetch_array($result)) { $Title = $row ['title']; $PostDateTime = $row ['postdatetime']; $Username=$row['username']; $url= "viewBlog.php?blogid=".$blogid; echo "<a href = $url> $Title $PostDateTime</a></br>"; } mysqli_close($dbc); ?> </body> </html> View Blog page : <?php $blogid= $_GET ['blogid']; $dbc = mysqli_connect('localhost','root','','blogdb') or die ('Error: Could not connect to database. Please try again'); $query = ("SELECT * FROM blogs WHERE blodid = '$blogid'"); $result = mysqli_query($dbc, $query); while($row = mysql_fetch_array($result)) { $Title = $row ['title']; $Content = $roe ['content']; echo "$Title $Content"; } mysqli_close($dbc); ?> Hello, I have php application, it is hosted on a shared server. How can I view the errors in my application with the details of the error for my website users? Thanks, 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(); } 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 Hi,
i have two methods with different function, each is calling to view a record from database. now i want store this two methods into one view.
ex.
model
function 1() { table_0ne } function 2() { table_two }controller function 1() { view 1,2 }it is possible, please help.. and i have code below, and it is not work when i apply $datax public function generate_po() { $po_id = $this->input->post('selector'); $data['result'] = $this->public_base_model->generate_po($po_id); $datax['result'] = $this->public_base_model->get_max_num(); 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, $datax); } else { $this->load->view('login'); } } This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=353984.0 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 my firefox won't open up .tpl format im running apache...how can i view that format on my apache please? |