Jump to content
php.lv forumi

Nogriež tekstu?


false

Recommended Posts

Tātad problēma ir tāda, kā pievienojot faila aprakstu viņš nogriež kādu daļu no beigam, un indexā kur izvēlk to aprakstu rāda arī to nogriezto tekstu nevis pilno.

sql

CREATE TABLE IF NOT EXISTS `faili` (
 `id` int(11) NOT NULL auto_increment,
 `who` varchar(255) collate utf8_unicode_ci NOT NULL,
 `fails` varchar(255) collate utf8_unicode_ci NOT NULL,
 `cikos` varchar(255) collate utf8_unicode_ci NOT NULL,
 `nosaukums` varchar(255) collate utf8_unicode_ci NOT NULL,
 `down` varchar(255) collate utf8_unicode_ci NOT NULL,
 `kategorija` varchar(255) collate utf8_unicode_ci NOT NULL,
 `apraksts` varchar(255) collate utf8_unicode_ci NOT NULL,
 PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

add.php

<p>
<?php
if(isset($_POST['submit'])){
$fails = $_POST['file'];
$who = mysql_real_escape_string($id);
$down = mysql_real_escape_string("0");
$nos = mysql_real_escape_string($_POST['nos']);
$now = mysql_real_escape_string(date("d/m/Y"));
$kat = mysql_real_escape_string($_POST['kategorija']);
$apraksts = mysql_real_escape_string($_POST['apraksts']);
mysql_query("INSERT INTO faili(who, fails, cikos, nosaukums, kategorija, apraksts, down) VALUES('$whom', '$fails', '$noww', '$nos', '$kat', '$apraksts', '$down')");


 }
?> 
<br/><form action="" method="post">
<table><tbody>
<tr><td>Fails:</td><td><input name="file" type="text"></td></tr><br />
<tr><td>Nosaukums:</td><td><input name="nos" type="text"><br/>
<tr><td>Kategorija:</td><td>
<select name="kategorija">
<?php
$selekt_cat = mysql_query("SELECT * FROM kategorijas ORDER BY id ASC");
while($u = mysql_fetch_array($selekt_cat)){
?>
<option value="<?php echo $u['id']; ?>"><?php echo $u['nosaukums']; ?></option>
<?php } ?>
</select></td></tr><br />
<tr><td>Apraksts:</td><td><textarea id="apraksts" name="apraksts" rows="10" cols="50"> </textarea></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="Ielādet!" /></td></tr></tbody></table>
</form></p>

select.php

										<?php
			$sqldd = mysql_query("SELECT * FROM faili ORDER BY down DESC LIMIT 5") or die(mysql_error());
			while($a = mysql_fetch_array($sqldd)){
			?>
		<div class="title"><h1><?php echo $a['nosaukums']; ?></h1> <a href="?p=file&id=<?php echo $a['id']; ?>">Vairāk informācijas</a></div>
		<div class="news_block">



<?php echo strlen($a['apraksts'])>450?substr($a['apraksts'],0,450).'...':$a['apraksts']; ?>
		</div>
<?php } ?>

Edited by false
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...