All pastes #511521 Raw Edit

Something

public text v1 · immutable
#511521 ·published 2007-05-26 14:12 UTC
rendered paste body
<?php
function q($query,$assoc=1) {
    $r = @mysql_query($query);
    if( mysql_errno() ) {
        $error = 'MYSQL ERROR #'.mysql_errno().' : <small>' . mysql_error(). '</small><br><VAR>$query</VAR>';
        echo($error); return FALSE;
    } 
    if( strtolower(substr($query,0,6)) != 'select' ) return array(mysql_affected_rows(),mysql_insert_id());
    $count = @mysql_num_rows($r);
    if( !$count ) return 0;
    if( $count == 1 ) {
        if( $assoc ) $f = mysql_fetch_assoc($r);
        else $f = mysql_fetch_row($r);
        mysql_free_result($r);
        if( count($f) == 1 ) {
            list($key) = array_keys($f);    
            return $f[$key];
        } else {
            $all = array();
            $all[] = $f;
            return $all;
        }
    } else {
        $all = array();
        for( $i = 0; $i < $count; $i++ ) {
            if( $assoc ) $f = mysql_fetch_assoc($r);
            else $f = mysql_fetch_row($r);
            $all[] = $f;
        }
        mysql_free_result($r);
        return $all;
    }
}

?>

<?php
include('../includes/conn_mysql.inc.php');
// create database connection
$conn = dbConnect();
$sql = 'SELECT p.title, p.description, p.url, i.filename, p.project_id
FROM projects p, images i 
WHERE i.project_id = p.project_id 
ORDER by p.project_id';
$here = 0;
$r = q($sql);

?>






<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<script type="text/javascript" src="clientside.moo.v1.packed.js"></script>
<script type="text/javascript" src="accordion4.js"></script>

			
			
			
<title>ilteris kaplan</title>
<link href="site_moo.css" rel="stylesheet" type="text/css" />
	
</head>

<body>
<div id="outer-container">
<div id="container">
<h1>MIXED WORKS BETWEEN 2001-2007</h1>







<?php


   	$result = mysql_query($sql);
	$sLastProjectID = 0; 
	$count = mysql_num_rows($result);
	echo $r[0]['filename'];  // <<< string.
	for($i = 0; $i < $count; $i++) { 
	
		?>

<a class="boxclosed" href="#"><?php echo $r[$i]['title']; ?></a>
<div class="boxopen" >
<div class="imageContent">
<img  alt="<?php echo $r[$i]['project_id']; ?>" src="../cms/files/images/<?php echo  $r[$i]['filename'];  ?>" />
</div>


<div class="thumbnails">
<a class="thumbs" href="<?php  echo $_SERVER['PHP_SELF'];  ?>?image_id=<?php  echo $imageRow['filename'];  ?>"></a>
</div>

<div class="textContent">
<p><?php echo $r[$i]['description']; ?></p>
<p class="titleDoc">
<a class="docLinks" href="<?php echo $r[$i]['url']; ?>">Project Site</a>
</p>



		 
		
<p><?php echo $r[$i]['project_id']; ?></p>

</div>


			 
	
	</div>

<?php 
	 $sLastProjectID =  $data[$i]['project_id'];
	} ?>
<div id="footer" > 
<p>Some rights are reserved others are not. ilteris at gmail dot com. - ilteris o. kaplan 2007</p>
</div>
</div>
</div>


</body>
</html>