Få vist data fra MySQL

Her kan du få hjælp og stille spørgsmål til MySQL/MySQLi!
Besvar
stonefox
Begynder
Indlæg:12
Tilmeldt:22. maj 2017, 01:43
Få vist data fra MySQL

Indlæg af stonefox » 3. jul 2017, 00:34

Hej

Har en MySQL database, som skal vises på min hjemmeside.
Søger URL'er på hjemmesider, hvor der ligger "Færdige" PHP filer, der kan vise dataerne.

Et ønske er :
at kunne vælge :
datoperiode
Stand-alone uge, måned og år.

Se vedhæftede billede for at se hvordan et ønske vil være at dataerne vises.
Vedhæftede filer
grafer.jpg
grafer.jpg (118.42KiB)Vist 7102 gange

cristian
Moderator
Moderator
Indlæg:882
Tilmeldt:26. sep 2011, 21:31
Kontakt:

Re: Få vist data fra MySQL

Indlæg af cristian » 6. jul 2017, 15:05

Grafen (nummber to billede) er rimelig lige til, men har ikke et eksempel lige her on nu.

Med hensyn til tabellen i billede et, biksede jeg hurtigt noget sammen.
Det kan laves bedre, som sagt dette er bare lige smækket sammen.

Men hensyn til at generer denne tabel med PHP, der står jeg af da jeg ikke roder med PHP.
Så hvis du vil lege lidt med Java så kan vi nok godt smække noget sammen som kan generer denne tabel for dig
så du bare skal klippe og klister den ind på din side.

Lad mig høre hvis du er frisk på det.

Kode: Vælg alt

<!DOCTYPE>
<html>
	<head>
		<title>Heat table</title>
		
		<!-- Meta data -->
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		
		<!-- Style -->
		
		<!-- JS -->
		
		<style>
			html, body, div, span, object, iframe,
			h1, h2, h3, h4, h5, h6, p, blockquote, pre,
			abbr, address, cite, code,
			del, dfn, em, img, ins, kbd, q, samp,
			small, strong, sub, sup, var,
			b, i,
			dl, dt, dd, ol, ul, li,
			fieldset, form, label, legend,
			table, caption, tbody, tfoot, thead, tr, th, td,
			article, aside, canvas, details, figcaption, figure, 
			footer, header, hgroup, menu, nav, section, summary,
			time, mark, audio, video {
			    margin:0;
			    padding:0;
			    border:0;
			    outline:0;
			    font-size:100%;
			    vertical-align:baseline;
			    background:transparent;
			}
			
			body {
			    line-height:1;
			}
			
			article,aside,details,figcaption,figure,
			footer,header,hgroup,menu,nav,section { 
			    display:block;
			}
			
			nav ul {
			    list-style:none;
			}
			
			blockquote, q {
			    quotes:none;
			}
			
			blockquote:before, blockquote:after,
			q:before, q:after {
			    content:'';
			    content:none;
			}
			
			a {
			    margin:0;
			    padding:0;
			    font-size:100%;
			    vertical-align:baseline;
			    background:transparent;
			}
			
			/* change colours to suit your needs */
			ins {
			    background-color:#ff9;
			    color:#000;
			    text-decoration:none;
			}
			
			/* change colours to suit your needs */
			mark {
			    background-color:#ff9;
			    color:#000; 
			    font-style:italic;
			    font-weight:bold;
			}
			
			del {
			    text-decoration: line-through;
			}
			
			abbr[title], dfn[title] {
			    border-bottom:1px dotted;
			    cursor:help;
			}
			
			table {
			    border-collapse:collapse;
			    border-spacing:0;
			}
			
			/* change border colour to suit your needs */
			hr {
			    display:block;
			    height:1px;
			    border:0;   
			    border-top:1px solid #cccccc;
			    margin:1em 0;
			    padding:0;
			}
			
			input, select {
			    vertical-align:middle;
			}
		</style>
		
		<style>
			table {
				border-collapse: collapse;
				background-color: hsla(36, 0%, 45%, 1.0);
				
				color: hsla(36, 0%, 85%, 1.0);
				
				text-align: center;
			}
			
			th:FIRST-CHILD {
				vertical-align: middle;
			}
			
			th:FIRST-CHILD, day {
				width: 10%;
			}
			
			th, td {
				border: 1px solid black;
			}
			
			.none {
				border: 0px;
			}
			
			.left {
				border-left: 1px solid black;
			}
			
			p {
				padding: 5px 7px;
			}
			
			.data-table {
				width: 100%;
			}
			
			.data-table tr td:nth-child(even) {
				width: 45px;
				max-width: 45px;
			}
			
			.data-table tr td:nth-child(odd) {
				width: 58px;
				max-width: 58px;
			}
			
			/*Heat colors*/
			.freeze {
				background-color: rgb(8,200,245);
				color: black;
			}
			
			.closeToZero {
				background-color: rgb(1,255,198);
				color: black;
			}
			
			.cold {
				background-color: rgb(1,253,153);
				color: black;
			}
			
			.hotter {
				background-color: rgb(205,254,2);
				color: black;
			}
			
			.hot {
				background-color: rgb(252,254,116);
				color: black;
			}
			
			.burning {
				background-color: rgb(255,203,0);
				color: black;
			}
		</style>
		
	</head>
	
	<body>
	
		<form>
			<p>Andet år</p>
			<select id="year">
				<option>2015</option>
				<option>2016</option>
				<option>2017</option>
			</select>
			
			<input type="button" value="Vis"/>
		</form>
	
		<table>
			<tr>
				<th rowspan="2"><p>Dag</p></th>
				<th><p>Jan</p></th>
				<th><p>Feb</p></th>
				<th><p>Mar</p></th>
				<th><p>Apr</p></th>
				<th><p>Maj</p></th>
				<th><p>Jun</p></th>
				<th><p>Jul</p></th>
				<th><p>Aug</p></th>
				<th><p>Sep</p></th>
			</tr>
			<tr>				
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table>
						<tr>
							<td class="none"><p>Maks</p></td>
							<td class="none left"><p>Min</p></td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr>
				<td class="day">1</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none cold"><p>8.2</p></td>
							<td class="none left freeze"><p>-2.7</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none closeToZero"><p>2.5</p></td>
							<td class="none left closeToZero"><p>0.8</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none cold"><p>6.8</p></td>
							<td class="none left closeToZero"><p>1.8</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none hot"><p>17.8</p></td>
							<td class="none left cold"><p>5.1</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none hotter"><p>14.6</p></td>
							<td class="none left cold"><p>2.7</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none hot"><p>18.1</p></td>
							<td class="none left cold"><p>8.1</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none burning"><p>23.9</p></td>
							<td class="none left hotter"><p>13.9</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class="day">2</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
				<td>
					<table class="data-table">
						<tr>
							<td class="none"><p>--</p></td>
							<td class="none left"><p>--</p></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>
Vedhæftede filer
tabelSmaekketSammen.PNG
tabelSmaekketSammen.PNG (19.59KiB)Vist 7091 gange

stonefox
Begynder
Indlæg:12
Tilmeldt:22. maj 2017, 01:43

Re: Få vist data fra MySQL

Indlæg af stonefox » 6. jul 2017, 23:39

Hej Cristian. Du må gerne kikke på opgaven. Hvad skal du bruge fra mig for at komme i gang ?

cristian
Moderator
Moderator
Indlæg:882
Tilmeldt:26. sep 2011, 21:31
Kontakt:

Re: Få vist data fra MySQL

Indlæg af cristian » 7. jul 2017, 11:39

stonefox skrev:Hej Cristian. Du må gerne kikke på opgaven. Hvad skal du bruge fra mig for at komme i gang ?
De data du vil have vist, kommer de direkte fra din MySQL eller generer du .xml filer hvor informationer står i?
Hvis det er .xml filer hvor kan jeg så finde disse? F.eks en url til din side hvor jeg kan finde dem.
Hvis det er direkte fra databasen så vil vi tage den på en PM (private message)

cristian
Moderator
Moderator
Indlæg:882
Tilmeldt:26. sep 2011, 21:31
Kontakt:

Re: Få vist data fra MySQL

Indlæg af cristian » 13. jul 2017, 14:09

Fik du løst dit problem?

Besvar