envie uma imagem, escreva a categoria, em seguida a descrição e um link
depois na hora de exibir exibisse só a img a categoria e a descrição, o link ficasse dentro da img
fiz no banco a seguinte tabela
clientes
com 3 campos
endereco (text) aonde vai ser guardado o endereco da img
descricao (text) aonde fica guardado a descricao da foto
categoria (text) aonde fica guardado a categoria
link (text) o link que sera embutido na imagem
Fiz a pagina envia.php
<?php require_once('Connections/t1.php'); ?> <?php // Load the common classes require_once('includes/common/KT_common.php'); // Load the tNG classes require_once('includes/tng/tNG.inc.php'); // Make a transaction dispatcher instance $tNGs = new tNG_dispatcher(""); // Make unified connection variable $conn_t1 = new KT_connection($t1, $database_t1); // Start trigger $formValidation = new tNG_FormValidation(); $tNGs->prepareValidation($formValidation); // End trigger // Make an insert transaction instance $ins_clientes = new tNG_insert($conn_t1); $tNGs->addTransaction($ins_clientes); // Register triggers $ins_clientes->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1"); $ins_clientes->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation); // Add columns $ins_clientes->setTable("clientes"); $ins_clientes->addColumn("endereco", "STRING_TYPE", "FILES", "endereco"); $ins_clientes->addColumn("link", "STRING_TYPE", "POST", "link"); $ins_clientes->addColumn("categoria", "STRING_TYPE", "POST", "categoria"); $ins_clientes->addColumn("descricao", "STRING_TYPE", "POST", "descricao"); $ins_clientes->setPrimaryKey("id", "NUMERIC_TYPE"); // Execute all the registered transactions $tNGs->executeTransactions(); // Get the transaction recordset $rsclientes = $tNGs->getRecordset("clientes"); $row_rsclientes = mysql_fetch_assoc($rsclientes); $totalRows_rsclientes = mysql_num_rows($rsclientes); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /> <script src="includes/common/js/base.js" type="text/javascript"></script> <script src="includes/common/js/utility.js" type="text/javascript"></script> <script src="includes/skins/style.js" type="text/javascript"></script> <?php echo $tNGs->displayValidationRules();?> </head> <body> <?php echo $tNGs->getErrorMsg(); ?> <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>" enctype="multipart/form-data"> <table cellpadding="2" cellspacing="0" class="KT_tngtable"> <tr> <td class="KT_th"><label for="endereco">Endereco:</label></td> <td><input type="file" name="endereco" id="endereco" size="32" /> <?php echo $tNGs->displayFieldError("clientes", "endereco"); ?></td> </tr> <tr> <td class="KT_th"><label for="link">Link:</label></td> <td><input type="text" name="link" id="link" value="<?php echo KT_escapeAttribute($row_rsclientes['link']); ?>" size="32" /> <?php echo $tNGs->displayFieldHint("link");?> <?php echo $tNGs->displayFieldError("clientes", "link"); ?></td> </tr> <tr> <td class="KT_th"><label for="categoria">Categoria:</label></td> <td><input type="text" name="categoria" id="categoria" value="<?php echo KT_escapeAttribute($row_rsclientes['categoria']); ?>" size="32" /> <?php echo $tNGs->displayFieldHint("categoria");?> <?php echo $tNGs->displayFieldError("clientes", "categoria"); ?></td> </tr> <tr> <td class="KT_th"><label for="descricao">Descricao:</label></td> <td><textarea name="descricao" id="descricao" cols="50" rows="5"><?php echo KT_escapeAttribute($row_rsclientes['descricao']); ?></textarea> <?php echo $tNGs->displayFieldHint("descricao");?> <?php echo $tNGs->displayFieldError("clientes", "descricao"); ?></td> </tr> <tr class="KT_buttons"> <td colspan="2"><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Insert record" /></td> </tr> </table> </form> <p> </p> </body> </html>
duvidas:
a imagem nao esta aparecendo, aparece somente aonde ela esta
pagina que ira exibir
<?php require_once('Connections/t1.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_t1, $t1); $query_Recordset1 = "SELECT * FROM clientes"; $Recordset1 = mysql_query($query_Recordset1, $t1) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table border="1"> <tr> <td>id</td> <td>endereco</td> <td>link</td> <td>categoria</td> <td>descricao</td> </tr> <?php do { ?> <tr> <td><?php echo $row_Recordset1['id']; ?></td> <td><?php echo $row_Recordset1['endereco']; ?></td> <td><?php echo $row_Recordset1['link']; ?></td> <td><?php echo $row_Recordset1['categoria']; ?></td> <td><?php echo $row_Recordset1['descricao']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </body> </html> <?php mysql_free_result($Recordset1); ?>