PHP - Table Fetch Data Help
Hi I have the following code works well However, if there is more than one record in the search result it shows the table lables on every record rather than just the one is it possible to have the table lables for just the result headings and not on each line after <?php require "header.php"; ?> <main> <link href="style.css" rel="stylesheet" type="text/css"> <div class="wrapper-main"> <div class="welcomelogged1"> <p>Searching For A Starter<p> </div> <form action="" method="post"> <select name="WeekComm" id="WeekComm"> <option value="Enter Week No To Search">Enter Week No To Search</option> <option value="WC 6th April">WC 6th April</option> <option value="WC 13th April">WC 13th April</option> <option value="WC 20th April">WC 20th April</option> </select> <input type="submit" name="Search" value="Search Starters"> </form> <?php $dBServername = "localhost"; $dBUsername = "root"; $dBPassword = ""; $dBName = "CandidateManagement"; mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect($dBServername, $dBUsername, $dBPassword, $dBName); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } if (isset($_POST['Search'])) { $WeekComm = $_POST['WeekComm']; $query = "SELECT * FROM contract where WeekComm='$WeekComm' "; $query_run = mysqli_query($conn,$query); while($row = mysqli_fetch_array($query_run)) { ?> <form action="" method="POST"> <table> <Tr><td><label></label></td> <td><label>Week Commencing</label></td> <td><label>First Name</label></td> <td><label>Last Name</label></td> <td><label>Start Date</label></td> <td><label>Client Name</label></td> <td><label>Action</label></td> </Tr> <tr> <td><input type="hidden" name="id" value="<?php echo $row['id'] ?>"></td> <td><input type="text" name="WeekComm" value="<?php echo $row['WeekComm'] ?>"></td> <td><input type="text" name="FirstName" value="<?php echo $row['FirstName'] ?>"></td> <td><input type="text" name="LastName" value="<?php echo $row['LastName'] ?>"></td> <td><input type="date" name="StartDate" value="<?php echo $row['StartDate'] ?>"></td> <td><input type="text" name="ClientName"value="<?php echo $row['ClientName'] ?>"></td> </tr> </form> <?php } }
I have attached a picture to show what i mean
Thanks Similar TutorialsHello 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. Okay so, I have always been curious, just never have taken the time to ask someone / learn what the differences are in fetches. What does mysql_fetch_array and mysql_fetch_row do thats different from each other? When pulling data from the database, would I like fetch array, or fetch row? or even fetch assoc? Thanks! Hi, I am trying to fetch all data from database. but any data show twice. like this: Ali Ali 30 30 Osman Osman 20 20 Omer Omer 40 40 Salim Salim 10 10 Suzan Suzan 25 25 $mem_qry = "SELECT * FROM tbl_name"; $res = mysql_query($mem_qry); function mysql_fetch_all($res) { $return = array(); while($row=mysql_fetch_array($res)) { $return[] = $row; } return $return; } $all = mysql_fetch_all($res); foreach($all as $k=>$v) { foreach($v as $k2=>$v2){ echo $v2.'<br />'; } } Hi, I am quite new to PHP and to learn more about it I decided I would make a little project to easy my life a little bit I want to make a site that fetches lunch menus from the restaurants nearby my work. I would just like some help getting pointed in the right direction on how to make this happen Thanks! Br, Niklas There is a school locator script at https://www.ocps.net/parents/pages/FindaSchool.aspx When we input any address it returns schools located in that locality. For example: Use these details and submit the form Street Number : 3902 Street Name : Bobolink Street Type : Lane City : Orlando It returns a row having three schools Elementary,Middle and High school On clicking the more button it takes to the respective school details So for each school I need the respective school names Audobon Elementary Glenridge Middle Winter Park High Please suggest some ways to achieve this functionality Thanks _________________________________________________ ____________________ http://travelinfo.techserveglobal.com/ http://blog.techserveglobal.com/ I am new in PHP Programming , Please Help me. I have made a data table, then i have connected this table after that I have made a table in my index.php file . but i am facing problem to show data from data table in my index.php file, can you help me to solve this problem?
<?php include "db.php"; ?> <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <title>Post Global Variable</title> </head> <body> <div class="row p-5"> <table class="table table-dark"> <thead> <tr> <th scope="col">#</th> <th scope="col">Name</th> <th scope="col">User Name</th> <th scope="col">Email Address</th> <th scope="col">Password</th> <th scope="col">Phone</th> <th scope="col">Join Date</th> <th scope="col">Action</th> </tr> </thead> <tbody> <?php $myQuery = "SELECT * FROM users"; $allUsers = mysqli_query ($db, $myQuery); while ($row = mysqli_fetch_assoc($allUsers)){ $id= $row['id']; $name= $row['name']; $userName= $row['userName']; $email= $row['email']; $password= $row['password']; $phone= $row['phone']; $join_date= $row['join_date']; ?> <tr> <th scope="row"><?php echo $id; ?></th> <td><?php echo $name; ?></td> <td><?php echo $userName; ?></td> <td><?php echo $email; ?></td> <td><?php echo $password; ?></td> <td><?php echo $phone; ?></td> <td><?php echo $join_date; ?></td> <td><a class="btn btn-success btn-sm" href="#" role="button">Update</a> <a class="btn btn-danger btn-sm" href="#" role="button">Delete</a> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> </body> </html> Edited March 3, 2020 by MH90 <html> <title>Micro Elite Brigade - Participated Events</title><LINK REL="SHORTCUT ICON" HREF="images/favicon.png"><?php require_once('upper.php'); if($_COOKIE['LoginIdCookie']){ require_once('database.php'); require_once('LoginStatement.php'); $LoginId=$_COOKIE['LoginIdCookie']; $query="select * from participation where LoginId='$LoginId'"; $result=mysqli_query($dbc,$query) or die ('Not Connected'); //echo "<div class='search_output_data'> echo "<table border='0' cellspacing='0' cellpadding='0'>"; echo "<tr><th align='left' valign='top' width='100' height='20'>Event Title</th> <th align='right' valign='top' width='250' height='30'>Date of Participation</th> </tr>"; while($row=mysqli_fetch_array($result)) { echo " <tr><td colspan='4' align='left' valign='top' ><table align='left' border='0' cellspacing='0' cellpadding='0'><tr><td align='left' valign='top' width='200' height='20'>".$row['Title']."</td> <td width='50'> </td> <td align='left' valign='top' width='130'>".$row['Date']."</td> </tr></table> </td></tr>"; } echo "</table>";} else{ echo 'Sorry, You must have to login.';} require_once('lower.php'); ?> HI friends..... I have a table named events in which I have a "Title" column. When I print the value of Title column, it not displayed not more than 40 characters.... Where is the problem ??? Anyone?????? hello dear community, good day,
I've been having an issue trying to parse text in a span cass with DOM. Here is my code example. try to extract some lines out of a webpage - with following technique: with the Extraction of values of attributes of elements with DOMDocument. Here is what i have gathered and learned:
$remote = "http://website.com/"; $doc = new DOMDocument(); @$doc->loadHTMLFile($remote); $xpath = new DOMXpath($doc); $node = $xpath->query('//span[@class="user"]'); echo $node;
and this returns the following
error -> "Catchable fatal error: Object of class DOMNodeList could not be converted to string".
And now - with this i need help.
What I am trying to do is parse the user name between this tag;
<div class="widget plugin-meta"> <h3 class="screen-reader-text">Meta</h3>
see more below:Here the concrete example view-source: https://wordpress.org/plugins/participants-database/ and https://wordpress.org/plugins/participants-database/
goal i need the following data:
Version: Last updated: Active installations: Tested up:
view-source: https://wordpress.org/plugins/participants-database/
Proceedings; i checked the source of the webpage. i tried to find out whether the texte is related to some kind of pattern.i have looked closely and found that all of them have class=”widget plugin-meta” . Well - This will make extracting them, a piece of cake. I tried with the code below helps to filter html elements based on values of attributes. but unfortunatley this ends up in a bad result; i need a helping hand and need to know how to parse the above mentioned data
Version: Last updated: Active installations: Tested up:
Any idea for the starting-point!? I love to hear from you.
//my controller <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; class homeController extends Controller { public function index() { $employee = DB::table('employee')->orderBy('id','desc')->get(); $department = DB::table('department')->orderBy('id','desc')->get(); return view('index', ['employee' => $employee , 'department' => $department]); } } //my routes Route::get('index','homeController@index'); //my view using blade temmplating engine @foreach($employee as $emp) <div class="employee"> <b>{{ $emp->name }} </b> <a href="employee/{{ $emp->id }}"> <p class="intro">{{ substr($emp->intro ,0, 50) }}...</p> </a> </div> @endforeach @foreach($department as $dep) <div class="department"> <b>{{ $dep->name }} </b> <a href="department/{{ $dep->id }}"> <p class="desc">{{ substr($dep->description ,0, 100) }}...</p> </a> </div> @endforeach I want to fetch using ajax, how can i do it, teach/help me
Hi,
<?php $connect = mysqli_connect('localhost', 'root', '1234', 'contact'); $query ='SELECT * FROM tbl_employee ORDER BY ID DESC'; $result = mysqli_query($connect, $query); ?>
<table id="employee_data" class="table table-striped table-bordered"> <thead> <tr> <td>Name</td> <td>Location</td> <td>Department</td> <td>Phone Number</td> </tr> </thead> <?php while($row = mysqli_fetch_array($result)) { echo ' <tr> <td>'.$row["name"].'</td> <td>'.$row["location"].'</td> <td>'.$row["department"].'</td> <td>'.$row['phone_number'].'</td> </tr> '; } ?> </table>
Hello I have an array with data from `mysql` that I would like to output it in a table using twig. The image is an example of want i want to achieve but without any luck. `print_r` of the array data Array ( [Administrator] => Array ( [0] => Array ( [RoleName] => Administrator [PermissionName] => Catalog-View [PermissionId] => 1 ) [1] => Array ( [RoleName] => Administrator [PermissionName] => Catalog-Edit [PermissionId] => 2 ) [2] => Array ( [RoleName] => Administrator [PermissionName] => Catalog-Delete [PermissionId] => 3 ) ) [Moderator] => Array ( [0] => Array ( [RoleName] => Moderator [PermissionName] => Catalog-View [PermissionId] => 1 ) ) ) The `HTML` code: <table> <tr> <thead> <th>Controller - Action</th> {% for permission in permissions %} {% for item in permission %} <th>{{item.RoleName}}</th> {% endfor %} {% endfor %} </thead> </tr> {% for permission in permissions %} {% for item in permission %} <tr> <td>{{item.PermissionName}}</td> <td>{{item.PermissionId}}</td> </tr> {% endfor %} {% endfor %} </table> OUTPUT: <table> <tbody> <tr></tr> </tbody> <thead> <tr> <th>Controller - Action</th> <th>Administrator</th> <th>Administrator</th> <th>Administrator</th> <th>Moderator</th> </tr> </thead> <tbody> <tr> <td>Catalog-View</td> <td>1</td> </tr> <tr> <td>Catalog-Edit</td> <td>2</td> </tr> <tr> <td>Catalog-Delete</td> <td>3</td> </tr> <tr> <td>Catalog-View</td> <td>1</td> </tr> </tbody> </table> Later Edit MySQL Query: SELECT t3.PermissionName, t1.PermissionId, t2.RoleName FROM tbl_user_role_perm AS t1 INNER JOIN tbl_user_roles AS t2 ON t1.RoleId = t2.RoleId INNER JOIN tbl_user_permissions AS t3 ON t1.PermissionId = t3.PermissionId MySQL Dump: -- Dumping structure for table tbl_user_permissions CREATE TABLE IF NOT EXISTS `tbl_user_permissions` ( `PermissionId` int(11) NOT NULL AUTO_INCREMENT, `PermissionName` varchar(50) NOT NULL, `PermissionDescription` varchar(100) NOT NULL, PRIMARY KEY (`PermissionId`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- Dumping data for table tbl_user_permissions: ~2 rows (approximately) DELETE FROM `tbl_user_permissions`; /*!40000 ALTER TABLE `tbl_user_permissions` DISABLE KEYS */; INSERT INTO `tbl_user_permissions` (`PermissionId`, `PermissionName`, `PermissionDescription`) VALUES (1, 'Catalog->View', 'View Catalog Method'), (2, 'Catalog->Edit', 'Edit Catalog Method'), (3, 'Catalog->Delete', 'Delete Catalog Method'); /*!40000 ALTER TABLE `tbl_user_permissions` ENABLE KEYS */; -- Dumping structure for table tbl_user_role CREATE TABLE IF NOT EXISTS `tbl_user_role` ( `UserRoleId` int(10) NOT NULL AUTO_INCREMENT, `UserId` int(10) NOT NULL, `RoleId` int(10) unsigned NOT NULL, PRIMARY KEY (`UserRoleId`), KEY `FK_tbl_user_role_tbl_user_roles` (`RoleId`), KEY `UserId` (`UserId`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- Dumping data for table tbl_user_role: ~2 rows (approximately) DELETE FROM `tbl_user_role`; /*!40000 ALTER TABLE `tbl_user_role` DISABLE KEYS */; INSERT INTO `tbl_user_role` (`UserRoleId`, `UserId`, `RoleId`) VALUES (1, 13, 22), (2, 14, 22); /*!40000 ALTER TABLE `tbl_user_role` ENABLE KEYS */; -- Dumping structure for table tbl_user_roles CREATE TABLE IF NOT EXISTS `tbl_user_roles` ( `RoleId` int(10) unsigned NOT NULL AUTO_INCREMENT, `RoleName` varchar(50) NOT NULL, `CreatedDate` datetime NOT NULL, `ModifiedDate` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`RoleId`) ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8; -- Dumping data for table tbl_user_roles: ~7 rows (approximately) DELETE FROM `tbl_user_roles`; /*!40000 ALTER TABLE `tbl_user_roles` DISABLE KEYS */; INSERT INTO `tbl_user_roles` (`RoleId`, `RoleName`, `CreatedDate`, `ModifiedDate`) VALUES (22, 'Administrator', '2014-10-28 09:53:08', NULL), (23, 'Moderator', '2014-10-28 09:53:13', NULL), (24, 'Admin', '2014-10-28 12:22:05', '2014-10-28 12:22:06'), (25, 'User', '2014-10-29 15:10:36', '2014-10-29 15:10:37'), (26, 'SuperUser', '2014-10-29 15:10:45', '2014-10-29 15:10:46'), (27, 'Accountant', '2014-10-29 15:10:53', '2014-10-29 15:10:54'), (28, 'God', '2014-10-29 15:11:02', '2014-10-29 15:11:02'); /*!40000 ALTER TABLE `tbl_user_roles` ENABLE KEYS */; -- Dumping structure for table tbl_user_role_perm CREATE TABLE IF NOT EXISTS `tbl_user_role_perm` ( `RoleId` int(10) unsigned NOT NULL, `PermissionId` int(10) unsigned NOT NULL, KEY `RoleId` (`RoleId`), KEY `PermissionId` (`PermissionId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Dumping data for table tbl_user_role_perm: ~3 rows (approximately) DELETE FROM `tbl_user_role_perm`; /*!40000 ALTER TABLE `tbl_user_role_perm` DISABLE KEYS */; INSERT INTO `tbl_user_role_perm` (`RoleId`, `PermissionId`) VALUES (22, 2), (22, 1), (23, 1), (22, 3); /*!40000 ALTER TABLE `tbl_user_role_perm` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;Can you help me to make the coding required so that the correct column have the correct permissions? thank you in advance. 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 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 First I need to create a table or add to an existing table - the table needs to contain a date -msg last sent date Then run the following email script for each record if the value of the msg last sent date is greater than >30 days??? after the script is run, it updates the records it emailed to todays date... <?php include "vsadmin/db_conn_open.php"; $allprods=mysql_query("select pID, pName, pPrice, pDropship, dsID, dsName, dsEmail from products, dropshipper where pDropship = dsID"); while ($yarr=mysql_fetch_assoc($allprods)){ $aname=$yarr["pID"]; $bname=$yarr["pName"]; $cname=$yarr["dsName"]; $dname=$yarr["dsEmail"]; $ename=$yarr["pPrice"]; $to = $dname; $subject = ("Your Ebook: " . $bname); $body = ("Hello " . $cname .",\n\nYou have the following ebook listed for sale on www.insertwebsite.com (". $bname ."). \nYour Ebook (product) is currently listed at the retail price of $" . $ename . "\n\nThe following link is provided to you as a marketing tool for your current or future email campaigns. This link is a direct link to your ebook on the Enlightened Ebooks site. \n www.www.insertwebsite.com/proddetail.php?prod=". $aname . "\n\nOnline sales is a safe secure way to increase your ebook sales. Simply provide the link in all your correspondences and you sales will increase. You are your own best promoter."); $headers = "From: neil@me.com\r\n" . "X-Mailer: php"; if (mail($to, $subject, $body, $headers)) { echo("<p><b>Message sent to.</b></P>". $cname . " for the following ebook " . $bname ); } else { echo("<p>Message delivery failed...</p>"); }} ?> What I'm wanting to do is instead of March-July have it always display the last 5 months and for the Visits th have it display the number of hits to my main page for each month and display the number of logins for each month to my CMS script. Can someone point me in the right direction? Code: [Select] <?php function get_visit_data_table() { echo "<table class=\"visualize_dashboard\">"; echo "<caption>Dashboard Chart Example</caption>"; echo "<thead>"; echo "<tr>"; echo "<td></td>"; echo "<th scope=\"col\">March</th>"; echo "<th scope=\"col\">April</th>"; echo "<th scope=\"col\">May</th>"; echo "<th scope=\"col\">June</th>"; echo "<th scope=\"col\">July</th>"; echo "</tr>"; echo "</thead>"; echo "<tbody>"; echo "<tr>"; echo "<th scope=\"row\">Visits</th>"; echo "<td>175</td>"; echo "<td>145</td>"; echo "<td>212</td>"; echo "<td>175</td>"; echo "<td>182</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\">Logins</th>"; echo "<td>94</td>"; echo "<td>53</td>"; echo "<td>124</td>"; echo "<td>92</td>"; echo "<td>105</td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; } ?> Hi,
A little new to php programming... I have a question:
I have written this code:
<html> <head> <title>Test</title> </head> <FONT FACE="Verdana, sans-serif"> <H3>Movies</h3> <?php include 'config.php'; include 'opendb.php'; $result = mysql_query("SELECT * FROM DayMovie ORDER BY FileDate") or die(mysql_error()); echo "<table border='1'>"; echo "<tr> <th>Filename</th><th>Path</th><th>Date</th><th>Filetype</th> <th>Size</th></tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['FileName']; echo "</td><td>"; echo $row['FilePath']; echo "</td><td>"; echo $row['FileDate']; echo "</td><td>"; echo $row['FileType']; echo "</td><td>"; echo $row['FileSize']; echo "</td></tr>"; } echo "</table>"; include 'closedb.php'; ?>I would like to have a link to these files on all the rows to open the files. How can I do that? I would also like that the link from the mysql row is not shown in the table. Only a text with the text "link" or "view". |