HTML Problem in displaying the items in different lines - php

I am trying to show three copies of the image in each line dynamically when I read it from the database, but it shows all the images next to each other. I tried to edit the code so it copies it but didn't work
How to make show three images in each line regardless of the number of items in the database?
Here is my code:
<?php
session_start();
require "init.php";
login();
?>
<html>
<head>
<title> Expert System </title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<table border='1' align='center' >
<?php
// LOGIN USER
function login(){
global $con;
global $counter;
//$email = $mysqli->escape_string('');
$query="SELECT * FROM users ";
$result=mysqli_query($con,$query);
if ( $result->num_rows == 0 ) // User doesn't exist
echo "User with that ID doesn't exist!";
else { // User exists
$counter=0;
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo '<td>
<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >
</td>';
echo '<td>
<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >
</td>';
echo '<td>
<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >
</td>';
echo "</tr>";
}
}
}
mysqli_close($con);
?>
</table>
</body>
</html>

According to a long discussion with the owner of this question, I'm posting my solution.
In your code you have to just move the table tag inside function.
<?php
// LOGIN USER
function login(){
// write remaining code.... and then use this while loop
echo '<table border="1" align="center">';
while($row = $result->fetch_assoc())
{ echo '<tr>';
// If you want 2 images in a row than use $i<= 2
for($i= 1; $i<= 3; $i++)
{
echo '<td><img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" ></td>';
}
echo '</tr>';
} // while
} // login()

Just use <tr> <img...> <tr> and remove <td> tag. <tr> represents row and <td> represents column. So because your <img> is inside <td> tags in <tr>, it is appearing in one row.
Here echo will not work, first made complete HTML then echo it once at the end. let see the example below.
Let see below, first what I am observing is that you are adding the same image thrice while it looks like you want to append the next image in the next row not the same image in each row.
Below I am just changing your code to show images in separate rows
$imagetags = "";
while($row = $result->fetch_assoc()) {
$imagetags .= "<tr><td>";
$imagetags .= '<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >'
$imagetags .= "</td></tr>";
$imagetags .= "<tr><td>";
$imagetags .= '<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >'
$imagetags .= "</td></tr>";
$imagetags .= "<tr><td>";
$imagetags .= '<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >'
$imagetags .= "</td></tr>";
}
But to show next image from DB row, in next row on HTML, you have to made changes in your code like below
$imagetags = "";
while($row = $result->fetch_assoc()) {
$imagetags .= "<tr><td>";
$imagetags .= '<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >'
$imagetags .= "</td></tr>";
}

that what shows with your code:
and that with my code:

You declared function inside of table but you called it before any html,that is why your images are not inside a table and not styled correctly, try this
<?php
session_start();
require "init.php";
// LOGIN USER
function login(){
global $con;
global $counter;
//$email = $mysqli->escape_string('');
$query="SELECT * FROM users ";
$result=mysqli_query($con,$query);
if ( $result->num_rows == 0 ) // User doesn't exist
echo "User with that ID doesn't exist!";
else { // User exists
$counter=0;
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo '<td>
<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >
</td>';
echo '<td>
<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >
</td>';
echo '<td>
<img src="images/' . $row["category"]. '" width="250px" height= "150px" alt="Avatar" >
</td>';
echo "</tr>";
}
}
}
mysqli_close($con);
?>
<html>
<head>
<title> Expert System </title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<table border='1' align='center' >
<?php login(); ?>
</table>
</body>
</html>

Related

SQL query doesn't give the right result

I have a form where people can search the database for four values:
Location, Period, Day and Service. I always do not get the results that I want.
If I use AND, people need to fill in everything. If I use OR I get the complete database. I want to be able to search the database for those one to 4 things. Is there a way how I can do this?
Is there maybe a way to check which fields are filled in, and that the query is automatically changed with the filled in fields?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Zoeken</title>
</head>
<body>
<p><img src="add.png" width="20px" height="20px"/> | <img src="search.png" width="20px" height="20px"/> | <img src="number.png" width="20px" height="20px"/> </p>
<form action="" method="post">
<div>
<table>
<tr><td><strong>Locatie: </strong></td><td><input type="text" name="Locatie" value="" /></td> </tr>
<tr><td><strong>Periode: </strong></td><td><input type="text" name="Periode" value="" /></td> </tr>
<tr><td><strong>Dag: </strong></td><td><input type="text" name="Dag" value="" /></td> </tr>
<tr><td><strong>Dienst: </strong></td> <td><input type="text" name="Dienst" value="" /></td></tr>
<tr><td></td><td><input type="submit" name="zoeken" value="Zoeken"></td></tr>
</table>
</div>
</form>
<p><img src="add.png" width="20px" height="20px"/> | <img src="search.png" width="20px" height="20px"/> | <img src="number.png" width="20px" height="20px"/> </p>
</body>
</html>
<?php
if (isset($_POST['zoeken']))
{
include('connect-db.php');
$Locatie = $_POST['Locatie'];
$Periode = $_POST['Periode'];
$Dag = $_POST['Dag'];
$Dienst = $_POST['Dienst'];
// get results from database
$result = mysql_query("SELECT * FROM WMC_DeLijn WHERE Locatie='$Locatie' ANY Periode='$Periode' ANY Dag='$Dag'ANY Dienst='$Dienst' ")
or die(mysql_error());
// display data in table
echo "<h2>Resultaten:</h2><p>";
echo "<table border='1' cellpadding='10'>";
echo "<table><tr><th>ID</th><th>Locatie</th><th>Periode</th><th>Dag</th><th>Dienst</th><th>Delen</th><th>Geleed</th><th>Start 1</th><th>Eind 1</th><th>Start 2</th><th>Eind 2</th><th>Lijnen</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td align="center">' . $row['id'] . '</td>';
echo '<td align="center">' . $row['Locatie'] . '</td>';
echo '<td align="center">' . $row['Periode'] . '</td>';
echo '<td align="center">' . $row['Dag'] . '</td>';
echo '<td align="center">' . $row['Dienst'] . '</td>';
echo '<td align="center">' . $row['Delen'] . '</td>';
echo '<td align="center">' . $row['Geleed'] . '</td>';
echo '<td align="center">' . $row['Start1'] . '</td>';
echo '<td align="center">' . $row['Eind1'] . '</td>';
echo '<td align="center">' . $row['Start2'] . '</td>';
echo '<td align="center">' . $row['Eind2'] . '</td>';
echo '<td align="center">' . $row['Lijnen'] . '</td>';
//Link to edit record
echo '<td align="center"><img src="edit.png" width="20px" height="20px"/></td>';
// Link to delete record
echo '<td align="center"><img src="delete.png" width="20px" height="20px"/></td>';
//Link to Add Event to Google Calendar
echo '<td align="center"><img src="proceed.png" width="20px" height="20px"/></td>';
echo "</tr>";
}}
// close table>
echo "</table>";
?>
You can either build the query string dynamically, only adding WHERE clause statements if the parameter is not falsy, or add conditions in the SQL itself like so: WHERE (col = ? OR '' = ?) AND (col2 = ? OR '' = ?).
Change your query to have either a AND condition or a OR condition like
SELECT * FROM WMC_DeLijn
WHERE Locatie='$Locatie'
AND Periode='$Periode'
AND Dag='$Dag'
AND ienst='$Dienst';
(OR)
SELECT * FROM WMC_DeLijn
WHERE Locatie='$Locatie'
OR Periode='$Periode'
OR Dag='$Dag'
OR ienst='$Dienst';

Use PHP variable in href inside of html inside of php?

So I'm trying to make a cart for my website (nothing too special, uni project).
Currently I have
$product_id = $row["ID"];
$product_name = $row['name'];
$product_price = $row['price'];
$product_image = $row['img'];
$imgurl = ".\img\\".$product_image;
if ($i % 3 == 0) { // if $i is divisible by our target number (in this case "3")
$dyn_table .= '<tr><td align="center" valign="middle" width="350">'. "<img src=$imgurl width='100' hieght='100'> <br />" . $product_name . '<br /> &pound'.$product_price . '<br /><a href="./cart.php?product="$product_id"&action=add" />Add to Card</a></td>';
} else {
$dyn_table .= '<td align="center" valign="middle" width="350">'. "<img src=$imgurl width='100' hieght='100'> <br />" . $product_name . '<br /> &pound'.$product_price . '<a href="./cart.php?product=$product_id&action=add" />Add to Card</a></td>';
I need to have the product ID inserted in href where I have $product_id
<a href="./cart.php?product=$product_id&action=add" />Add to Card</a>
Currenly, it loads the links as domain.com/cart.php?product=$product_id&action=add
you can use variable name between quotes
provided if it is a single quoted you have to put {} around variable
else if it is a double quotes you can directly use the varibale
if ($i % 3 == 0) {
$dyn_table .= "<tr><td align='center' valign='middle' width='350'>". "<img src=$imgurl width='100' hieght='100'> <br />" . $product_name . "<br /> &pound".$product_price . "<br />
<a href='./cart.php?product={$product_id}&action=add' />Add to Card</a></td>";
} else {
$dyn_table .= "<td align='center' valign='middle' width='350'>". "<img src=$imgurl width='100' hieght='100'> <br />" . $product_name . "<br /> &pound".$product_price . "<a href='./cart.php?product={$product_id}&action=add' />Add to Card</a></td>";
}
The variable has to be extracted from the string, in PHP, so:
<a href="./cart.php?product='.$product_id.'&action=add" />Add to Card</a>
Like you did for your other variables.
this:
$dyn_table .= '<tr><td align="center" valign="middle" width="350">'."<img src=$imgurl width='100' hieght='100'><br />" . $product_name.'<br /> &pound'.$product_price .'<br /><a href="./cart.php?product=" .$product_id. "&action=add." />Add to Card</a></td>';
Your original problem was that you didn't jump out of single quotes properly to add $product_id in, however there's another instrumental problem in your code.
You should either use all '' single quotes or all "" double quotes, not a combination of both. It makes it hard to read and is unnecessary regardless.
Therefore, it should be either
$dyn_table .= '<tr><td align="center" valign="middle" width="350"><img src="' . $imgurl . '" width="100" hieght="100"> <br />' . $product_name . '<br /> £' . $product_price . '<br /><a href="./cart.php?product=' . $product_id . '&action=add" />Add to Card</a></td>';
or
$dyn_table .= "<tr><td align=\"center\" valign=\"middle\" width=\"350\"><img src=\"$imgurl\" width=\"100\" hieght=\"100\"> <br />$product_name<br /> £$product_price<br /><a href=\"./cart.php?product=$product_id&action=add\" />Add to Card</a></td>";
In this case, I'd probably use single quotes so I don't have to escape all the double quotes in the HTML, or perhaps even a heredoc, but I won't get into those for now.
Your code for single quotes would be
if ($i % 3 == 0) { // if $i is divisible by our target number (in this case "3")
$dyn_table .= '<tr><td align="center" valign="middle" width="350"><img src="' . $imgurl . '" width="100" height="100"> <br />' . $product_name . '<br /> £' . $product_price . '<br /><a href="./cart.php?product=' . $product_id . '&action=add" />Add to Card</a></td>';
} else {
$dyn_table .= '<td align="center" valign="middle" width="350"><img src="' . $imgurl . '" width="100" hieght="100"> <br />' . $product_name . '<br /> £' . $product_price . '<a href="./cart.php?product=' . $product_id . '&action=add" />Add to Card</a></td>';
I'd suggest you look up heredocs though, you may find those easier.

how to display an image in pagination?

How will i Display a picture with the same id here in my pagination.php?
i tried doing this
<td width="20%" valign="top"><a href="product.php?id=' . $id . '">
<img style="border:#666 2px solid;" src="inventory_images/' . $id . '.jpg" width="150" height="102" border="1" /></a>
</td>
but it wont work.. any possible way to display the image using pagination?
for ($i = $start; $i < $end; $i++)
{
// make sure that PHP doesn't try to show results that don't exist
if ($i == $total_results) { break; }
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . mysql_result($result, $i, 'product_name') . '</td>';
echo '<td>' . mysql_result($result, $i, 'price') . '</td>';
echo '<td>' . mysql_result($result, $i, 'details') . '</td>';
echo '<td>' . mysql_result($result, $i, 'category') . '</td>';
echo '<td>' . mysql_result($result, $i, 'subcategory') . '</td>';
echo '<td>Click To View</td>';
echo "</tr>";
}
Probably you have to put in your code something like that :
<td width="20%" valign="top">
<a href="product.php?id=<?php echo $id; ?>">
<img style="border:#666 2px solid;" src="inventory_images/<?php echo $id; ?>.jpg" width="150" height="102" border="1" />
</a>
</td>
Check the generated source and adjust the code above. Please keep in mind that in HTML you cannot put php variables directly. You have to output them with php echo statement like that :
<html>
SOME HTML
<div class="valueFromPhp"><?php echo $value; ?></div>
</html>
Also remebmer to escape output using htmlentities() to prevent XSS attacks.
echo '
<td>
<img width=100 src="../PHP/saved_images/'.mysql_result($result, $i, "bkimg").'">
</td>
';

pass form data in a new window to edit and save

I'm trying to figure out how to pass form data collected from sql database to a new window.
The idea is when the user click 'Rediger' (edit), that a new small window will open up with the current data and an input field for the user to change the data, and then hit the save button for the data to be written to the database. Then the window must close and the original page being updated with the new data.
Is this possible?
Can anyone please help me with this?
Thank you.
Check out the page here: http://kristoff.it/onlinecoaching/coach/
Here is my code:
<?php
/*Template Name: coach*/
?>
<?php
session_start();
$coachId = $_SESSION['coachId'];
$fornavn = $_SESSION['fornavn'];
$efternavn = $_SESSION['efternavn'];
$titel = $_SESSION['titel'];
$beskrivKort = $_SESSION['beskrivKort'];
$tlf = $_SESSION['tlf'];
$email = $_SESSION['email'];
$skype = $_SESSION['skype'];
$messenger = $_SESSION['messenger'];
$session30 = $_SESSION['session30'];
$session60 = $_SESSION['session60'];
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset');?>">
<title>
<?php
global $page, $paged;
wp_title( '|', true, 'right' );
bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s' ), max( $paged, $page ) );
?>
</title>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script('comment-reply'); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div class="outerWrapper">
<div><img src="http://kristoff.it/onlinecoaching/wp-content/uploads/2013/05/logo.png" width="726" height="114" alt="OnlineCoaching"></div>
<div align="center">
<div class="contentForside">
<form method="POST" action="" id="submitcoach">
<?
$sql = "SELECT * FROM coach where coachId=1";
$result = mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
echo '<div class="coachgreen">';
echo '<h1>Velkommen coach ' . $row['fornavn'] . '</h1>';
echo '<div class="coachwhite">';
echo '<table border="0" align="left" width="99%">';
echo '<tr><td align="center" valign="top">';
echo '<table border="0" valign="top" width="130">';
echo '<tr><td><img id="coachImg" src="' . $row['imgUrl'] . '" width="110" height="120" alt="' . $row['imgAlt'] . '"></td></tr>';
echo '<tr><td valign="top"><p>Skift billede</p></td></tr>';
echo '<tr><td valign="top"> </td></tr>';
echo '<tr><td><img id="coachImg" src="http://kristoff.it/onlinecoaching/wp-content/uploads/2013/05/allanscherfig_video.jpg" width="110" height="120" alt="' . $row['imgAlt'] . '"></td></tr>';
echo '<tr><td valign="top"><p>Upload ny video</p>' . '</td></tr>';
echo '</table>';
echo '</td>';
echo '<td valign="top"><br>';
echo '<table width="100%" border="0">';
echo '<tr height="25">';
echo '<td valign="top"width="15%"><p id="coach"><b>Titel</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['titel'] . '</p></td>';
echo '<td><p id="coach">Rediger</p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Beskrivelse kort</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['beskrivKort'] . '</p></td>';
echo '<td valign="top"><p id="coach">Rediger</p></td>';
echo '</tr>';
echo '<tr height="110">';
echo '<td valign="top"><p id="coach"><b>Beskrivelse lang</b></p></td>';
echo '<td valign="bottom"><div id="beskrivLang"><p id="coach">' . $row['beskrivLang'] . '</p></div></td>';
echo '<td valign="top"><p id="coach">Rediger</p></td>';
echo '</tr>';
echo '<tr height="10"><td colspan="3"> </td></tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Brugernavn</b></p></td>';
echo '<td valign="top"><p id="coach">brugernavn</p></td>';
echo '<td valign="top"><p id="coach"> </p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Adgangskode</b></p></td>';
echo '<td valign="top"><p id="coach">Adgangskode</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Klient telefon</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['tlf'] . '</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Skype</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['skype'] . '</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="22">';
echo '<td valign="top"><p id="coach"><b>Messenger</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['messenger'] . '</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="42">';
echo '<td align="right" valign="bottom"> </td>';
echo '<td valign="top"> </td>';
echo '<td valign="top"> </td>';
echo '</tr>';
echo '</table>';
echo '</td></tr>';
echo '</table';
}
?>
</form>
</div>
</div>
</div>
</div><!-- end contentForside -->
</div><!-- end center -->
</div> <!-- end outerWrapper -->
<div align="center">
<div class="copyright">
<?php echo 'copyright © ' . date('Y ') . 'kristoff.it' ;?>
</div>
</div>
</body>
</html>
When you create the new page with the form data to edit, include a hidden field that uniquely identifies what you are editing - ideally a unique key and table reference. When they click on the submit button, your form processor will then know which table and entry in that table to update.
Be sure to validate the data from the form as a user could of course attempt to maliciously modify that hidden data.
Edit: Once you have made the update, you can rebuild the page and show it to the user - it will appear to them they have updated a field in the original page.
You can do the update dynamically with ajax, but that is a longer story...

Is there a better or more efficient way to do this?

This code is working for what I need it to do, but (in my opinion) it looks bad so I am hoping someone knows of a cleaner or more efficient way to do the same thing. I have several entries being pulled from the database and I want them to be styled identically. Only the logo and the the link name will change eventually I will add a description. Here is the code:
<div class="content">
<?PHP
while($row = $stmt->fetch())
{
$name = $row['name'];
$id = $row['id'];
$logo = $row['logo'];
$username = $row['username'];
echo "<div class=" . "Links" . ">";
echo "<div class=" . "linkImages" . ">";
echo "<br>" . "" . "<img src=" . "users/" . $username . "/images/" . $logo . " " . "width=" . "200" . " " . "height=" . "auto" . " " . "border=" . "0" . "/>" . "";
echo "</div>";
echo "<div class=" . "linkName" . ">";
echo "" . $name ."";
echo "</div>";
echo "</div>";
}
?>
</div>
You can trivially remove most of the echoes and string concatenation by switching to a HEREDOC:
while($row = $stmt->fetch()) {
echo <<<EOL
<div class="links">
yadayada
<br><a href="Profile.php?id={$row['id']}"><img src="users/{$row['username']}" etc....
yada yada yada
EOL;
Note that the lack of escapes in there, allowing for proper quotes around the tag attributes, and the {} notation on the embedded variables.
Don't use extra variable names. Instead, use the original.
Also, don't output every row with PHP. Use plain HTML and add the variable in it later:
<div class="Links">
<?=$row['name']?>
Or just echo as 1 line, no need for concatenation
echo "<div class=\"linkImages\">";
or
echo '<div class="linkImages">';
echo '<div class="content">';
while($row = $stmt->fetch()){
$name = $row['name'];
$id = $row['id'];
$logo = $row['logo'];
$username = $row['username'];
echo '<div class="Links">
<div class="linkImages">
<br><img src="users/'.$username.'/images/'. $logo .'" width="200" height="auto" border="0">
</div>
<div class="linkName">
'.$name.'
</div>
</div>';
}
echo '</div>';
Here's how I would write it:
<div class="content">
<?php
while ($row = $stmt->fetch()){
echo '<div class="Links">';
echo '<div class="linkImages">';
echo '<br /><img src="users/'. $row['username'] .'/images/'. $row['logo'] .'" width="200" />';
echo '</div>';
echo '<div class="linkName">';
echo ''. $row['name'] .'';
echo '</div>';
}
?>
</div>
Note that I removed the border="0" for the img tag - that should be done with CSS.
The short answer is yes. There is almost always a cleaner or more efficient way to do it.
How about something like this?
<div class="content">
<?PHP while($row = $stmt->fetch()) { ?>
<div class="Links">
<div class="linkImages">
<br><img src="users/<?=$row['username'] ?>/images/<?=$row['logo'] ?> width="200" height="auto" border="0" />
</div>
<div class="linkName">
<a href="Profile.php?id="<?=$row['id'] ?>><?=$row['name'] ?></a>
</div>
</div>
<?PHP } ?>
</div>
There are a lot of erroneous symbols etc in this, it comes with practice, but something like this might be worth trying
<?php
while($row = $stmt->fetch()) {
$string = "";
$string .= "<div class=\"Links\">\n";
$string .= "<div class=\"linkImages\">\n";
$string .= "<br />\n";
$string .= "<img src=\"users/". $row['name'] ."/images/" . $row['logo'] . "\" width=\"200\" height=\"auto\" border=\"0\" />\n";
$string .= "</div>\n";
$string .= "<div class=\"linkName\">\n";
$string .= "". $row['name'] ."\n";
$string .= "</div>\n";
$string .= "</div>\n";
echo $string;
}
?>
I'd recommend learning how to use the printf() family of functions.
$frame = '<img src="users/%s/images/%s" width="200" height="auto" border="0"/>';
printf($frame, $id, $username, $logo);

Categories