Jump to content

[SOLVED] Simple Error


sam06

Recommended Posts

Unfortunetly I'm getting errors with this:

<?php
$cat = $_GET['view'];
$user = $_GET['user'];

mysql_connect("localhost", "****", "****") or die(mysql_error());
mysql_select_db("*******") or die(mysql_error());

$query = "SELECT * FROM offers WHERE
category=$cat"; 

$result = mysql_query($query) or die(mysql_error());


echo "<table border='0'>";
echo "<tr> <th>Name</th> <th>Description</th></tr>";

while($row = mysql_fetch_array( $result )) {

echo "<tr><td>"; 
echo '.$row['Name'].';
echo "</td><td>"; 
echo "'.$row['Description'].'";
echo "</td><td>"; 
echo "'<a href="click.php?id='.$row['id'].'&user=$user">Visit</a>'";
echo "</td></tr>"; 

} 

?>

 

Page:

http://www.sam06.tfcph.com/reward/display.php?view=free

 

Ideally is there a way to display it not in a table, but so It shows them under each other, so NAME, under the DESCRIPTION, than under the LINK.

 

Thanks,

Sam

Link to comment
https://forums.phpfreaks.com/topic/113362-solved-simple-error/
Share on other sites

This line

echo '.$row['Name'].';
should be
echo $row['Name'];
unless you want quotes
printf("'%s'",$row['Name']); or
        echo "'$row['Name']'";

 

plus this line

at href= is closing the double quote

echo "'<a href="click.php?id='.$row['id'].'&user=$user">Visit</a>'";

Link to comment
https://forums.phpfreaks.com/topic/113362-solved-simple-error/#findComment-582403
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.