Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie dummy question (DIV and mysql queries)

Status
Not open for further replies.

brlissab

Technical User
Oct 11, 2002
35
0
0
CH
Hello friends
after tried some tables to fix displayed queries, seems it is much more flexible with css.
here some tries:
Code:
<?php
require_once ('mysqli_connect.php');
 $q="SELECT * FROM imagens";
 $result = @mysqli_query ($dbc, $q)
 or die("Error: ".mysqli_error($dbc));
while ($rows = mysqli_fetch_array($result))
{
extract ($rows);
$image_nome = $rows['imagem_nome'];
 $image_data = $rows['imagem_data']; 
  $image_id = $rows['imagem_id']; 
            }
?>
<html>
<head>
       <link rel="stylesheet" href="includes/css1.css" type="text/css" media="screen" />
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
     <title>Details</title>
 </head>
 <body>
 <div id="container">
<img src="<?php echo "../images/$rows['imagem_nome']" ?>" border='0'>
</div>
</body>
</html>
gives me an error
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in D:\Program Files\EasyPHP 3.0\ on line 21"
seems that i have a little problem with double quotes? tried to chane into ' but doesn't have great impact on script....
If if a kind soul could advertise me i would be great.
Thnk u
 
yes thank u!
ive replaced the code between the DIV tag for
Code:
<img src="<?php echo "a href='../images/{$rows['imagem_nome']}'
                           border='0'>
            <img src='../images/{$rows['imagem_nome']}' border='0'
              width='100' height='80'></a>" ?>
works, no error on executing the script but doesn't display correctly the image (only u know a little graphic....) and the request has a while loop who normally displays all the images on the db.....
What must i change on my code?
thank u
 
tried this and have my columns displayed.
Code:
<?php
$connection = mysql_connect("localhost" , "user" , "pass") or die ("Can't connect to MySQL");
$db = mysql_select_db("db" , $connection) or die ("Can't select database.");

$cols = 2;
$size = (80/$cols) - 5;
$result = mysql_query("SELECT * FROM imagens order by imagem_id desc") or die (mysql_error());
if (mysql_num_rows($result) > 0){
    echo <<<CSS
<style>
html, body, div, img {padding:0px; margin:0px;}
.results { width: 30%; margin: 0 auto; clear:both; overflow:hidden; }
.cell {width: {$size}%; float:left;}
.result
{
clear:both; 
overflow:hidden;
margin: 0 auto;
position: absolute;
width: 30%;
}
</style>
<div class="result">    
CSS;
    while ($t = mysql_fetch_object($result)) {
        echo <<<HTML
<div class="cell">
<a href=../images/{$t->imagem_nome} border='0'>
<img src='../images/{$t->imagem_nome}' width='100' height='80' border='0'></a>
</div>
HTML;
}
echo "</div><!--close results div--!>";
} else {
    echo "no results";
}

?>

how can i reuse the query to retrive more results from it?
now i have the thumbnail on the left and i wnat to have infos from the query on the rigth like this
img | date
img | description
img | category

so the idea is to reuse the query to display other infos...how do i get that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top