Sponsored Content
Full Discussion: PHP table isn't displaying
Top Forums Web Development PHP table isn't displaying Post 302934557 by sea on Sunday 8th of February 2015 04:32:14 PM
Old 02-08-2015
I didnt say 'remove' i said 'outside the loop'.

OLD:
Code:
        while($row = mysqli_fetch_array($result)){
            echo "<tr>";
            echo "<td>" . $row['name'] . "</td>";
            echo "<td>" . $row['lastname'] . "</td>";
            echo "</tr>";
            echo "</table>";
        }
        mysqli_close($conn);

NEW:
Code:
        while($row = mysqli_fetch_array($result)){
            echo "<tr>";
            echo "<td>" . $row['name'] . "</td>";
            echo "<td>" . $row['lastname'] . "</td>";
            echo "</tr>";
        }
        echo "</table>";
        mysqli_close($conn);

Though...you should see at least one line now anyway...

Hope this helps

EDIT:
After rereading, i assume there is a missing dollar sign before the username:
Code:
$sql = "SELECT * from username ORDER BY id DESC LIMIT 1";

Code:
$sql = "SELECT * from $username ORDER BY id DESC LIMIT 1";

I'm a bit rusty on php, not sure if you need to 'split' the string to connect it with the variable...

Last edited by sea; 02-08-2015 at 10:54 PM..
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

displaying output in a table.

Hello, I've just finished my first script (about displaying open ports on the computer and who opened them) and everything is fine with it but I want to style it a little bit just for the sake of learning how to do this. What I want to do is make the display like the one of ps, for example,... (6 Replies)
Discussion started by: sanchopansa
6 Replies

2. Shell Programming and Scripting

PHP: Sorting HTML table

Hi All, I have an html table which looks like this: <table align="center" border="1"> <CAPTION><EM>Heading for Table</EM></CAPTION> <tr><td><b>1</b></TD><TD><b>2</b></TD><TD><b>3</b></TD><TD><b>4</b></TD><TD><b>TOTAL</b></TD><TD><b>DATE</b></td></tr> <tr><td>88088283</TD> <TD>87613101</TD>... (1 Reply)
Discussion started by: pondlife
1 Replies

3. Web Development

php script + not displaying webpage

Hi guys Im in the process of designing a website for my company which does the following 1) Daily execution a perl script. The perl script's output is diverted to a .html file. 2) The .html file generated from 1) sets up a centralised webpage showing options as radio buttons (the radio... (1 Reply)
Discussion started by: JamesGoh
1 Replies

4. UNIX for Dummies Questions & Answers

Displaying text from a MySQL table which can be modified

Hi am creating a website for my third year at uni, am trying to create a website where the client can update the content of the site themselves, i will have a news page and i want the content to be draw from my database and displayed on the front end of the site i also want to have an admin side... (3 Replies)
Discussion started by: richeyrich86
3 Replies

5. Homework & Coursework Questions

Displaying text from a MySQL table which can be modified

Hi am creating a website for my third year at uni, am trying to create a website where the client can update the content of the site themselves, i will have a news page and i want the content to be draw from my database and displayed on the front end of the site using php, i also want to have an... (1 Reply)
Discussion started by: richeyrich86
1 Replies

6. Shell Programming and Scripting

how to convert a shell script to a php script for displaying next word after pattern match

I have a shell script which I made with the help of this forum #!/bin/sh RuleNum=$1 cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}' Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Discussion started by: sb245
0 Replies

7. Programming

Table Duplication in PHP

Hey, I am making a Facebook like Page system as my first project, So far it's been bate in mind I did it from my 3DS at the same time as my PC gets replaced, So far it's turned out great. Now I am on to creation the blocking system I need to get the code to say If the user already likes the... (0 Replies)
Discussion started by: AimyThomas
0 Replies

8. Web Development

Getting Rid of Annoying Bootstrap Table Borders and Wayward Table Lines

Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer: <script> $(function(){ $('tr, td, fieldset,... (0 Replies)
Discussion started by: Neo
0 Replies
FLUSH(3)								 1								  FLUSH(3)

flush - Flush system output buffer

SYNOPSIS
void flush (void ) DESCRIPTION
Flushes the system write buffers of PHP and whatever backend PHP is using (CGI, a web server, etc). This attempts to push current output all the way to the browser with a few caveats. flush(3) may not be able to override the buffering scheme of your web server and it has no effect on any client-side buffering in the browser. It also doesn't affect PHP's userspace output buffering mechanism. This means you will have to call both ob_flush(3) and flush(3) to flush the ob output buffers if you are using those. Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser. Server modules for Apache like mod_gzip may do buffering of their own that will cause flush(3) to not result in data being sent immedi- ately to the client. Even the browser may buffer its input before displaying it. Netscape, for example, buffers text until it receives an end-of-line or the beginning of a tag, and it won't render tables until the </table> tag of the outermost table is seen. Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. RETURN VALUES
No value is returned. SEE ALSO
ob_flush(3), ob_clean(3), ob_end_flush(3), ob_end_clean(3). PHP Documentation Group FLUSH(3)
All times are GMT -4. The time now is 06:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy