Jump to content
php.lv forumi

zintis8789

Reģistrētie lietotāji
  • Posts

    139
  • Joined

  • Last visited

Posts posted by zintis8789

  1. </head>
    <body>
    <table border=1>
    <tr>
    <th>Albums</th>
    <th>Izpilditajs</th>
    <th>Dziesma</th>
    <th>Balsis</th>
    <th>Nobalsot</th>
    </tr>
    <?php
    /**
    Display the results from the database
    **/
    $q = "SELECT * FROM top";
    $r = mysql_query($q);
    
    if(mysql_num_rows($r)>0): //table is non-empty
           while($row = mysql_fetch_assoc($r)):
                   $net_vote = $row['votes_up'] - $row['votes_down']; //this is the net result of voting up and voting down
    ?>
    
    <tr>
    <th><?php echo $row['albums']; ?></th>
    <th><?php echo $row['izpilditajs']; ?></th>
    <th><?php echo $row['dziesma']; ?></th>
    <th><span class='votes_count' id='votes_count<?php echo $row['id']; ?>'><?php echo $net_vote.""; ?></span></th>
    <th>
    <span class='vote_buttons' id='vote_buttons<?php echo $row['id']; ?>'>
                   <a href='javascript:;' class='vote_up' id='<?php echo $row['id']; ?>'></a>
                   <a href='javascript:;' class='vote_down' id='<?php echo $row['id']; ?>'></a>
    </span>
    </th>
    </tr>
    
    <?php
           endwhile;
    endif;
    ?> 
    </table>
    </body>
    </html>

  2. Man ir sads kods:

    <script type="text/javascript" src="ckeditor.js"></script>
    
    
    
    
    
    <?php
    
    include("config.php");
    $u = $_GET['id'];
    $result12 = mysql_query("SELECT * FROM `jaunumi` WHERE id='$u'");
    $row1 = mysql_fetch_assoc($result12)or die(mysql_error());
    $nosaukums = $row1[nos];
    $ie = $row1[ievads];
    $tests = $row1[zina];
    
    
    
    $nos = $_POST['nos'];
    $zina = $_POST['zina'];
    
    
    $ievads = $_POST['ievads'];
    
    
    mysql_query("SET NAMES UTF8 COLLATE utf8_general_ci"); 
    
    
    
    if(isset($_POST['submit'])){
    
    if(!$nos || !$zina || !$ievads){
    echo "<font color=red>Aizpildi visus laukumus</font>";
    echo "<meta http-equiv='refresh' content='0; url=index.php'>";
    }else{
    $u = $_GET['id'];
    mysql_query("UPDATE jaunumi SET nos='$nos', zina='$zina', ievads='$ievads' WHERE id='$u' ");
    
    
    
    
    
    
    echo "<font color=green>Esi veiksmigi editojis jaunumus</font> ";
    
    
    }
    }
    ?>
    
    
    	<center>
    
    
    
    
    
    
    			<form method="post" action="" >
    
    Nosaukums: <input type=text name=nos value="<? echo $nosaukums; ?>" >
    
    
    <p>Ievads:
    <textarea name=ievads >
    <? echo $ie; ?>
    </textarea>
    <p>Teksts:
    <textarea name=zina >
    <? echo $tests; ?>
    </textarea>
    
    <p> <input type=submit name=submit value=EDITOT>
    
    
    </p>
    
    </form>
    
    
    		<script type="text/javascript">
    			CKEDITOR.replace( 'zina' );
    			CKEDITOR.replace( 'ievads' );
    		</script>

    Es izvelu tekstu no db editoju spiezu lai saglaba bet nesaglabajas izmainas.

  3. Array

    (

    [Table] => ipb_topics

    [Create Table] => CREATE TABLE `ipb_topics` (

    `tid` int(10) NOT NULL auto_increment,

    `title` varchar(250) NOT NULL,

    `description` varchar(250) default NULL,

    `state` varchar(8) default NULL,

    `posts` int(10) default NULL,

    `starter_id` mediumint(8) NOT NULL default '0',

    `start_date` int(10) default NULL,

    `last_poster_id` mediumint(8) NOT NULL default '0',

    `last_post` int(10) default NULL,

    `icon_id` tinyint(2) default NULL,

    `starter_name` varchar(255) default NULL,

    `last_poster_name` varchar(255) default NULL,

    `poll_state` varchar(8) default NULL,

    `last_vote` int(10) default NULL,

    `views` int(10) default NULL,

    `forum_id` smallint(5) NOT NULL default '0',

    `approved` tinyint(1) NOT NULL default '0',

    `author_mode` tinyint(1) default NULL,

    `pinned` tinyint(1) default NULL,

    `moved_to` varchar(64) default NULL,

    `total_votes` int(5) NOT NULL default '0',

    `topic_hasattach` smallint(5) NOT NULL default '0',

    `topic_firstpost` int(10) NOT NULL default '0',

    `topic_queuedposts` int(10) NOT NULL default '0',

    `topic_open_time` int(10) NOT NULL default '0',

    `topic_close_time` int(10) NOT NULL default '0',

    `topic_rating_total` smallint(5) unsigned NOT NULL default '0',

    `topic_rating_hits` smallint(5) unsigned NOT NULL default '0',

    `title_seo` varchar(250) NOT NULL default '',

    `seo_last_name` varchar(255) NOT NULL default '',

    `seo_first_name` varchar(255) NOT NULL default '',

    PRIMARY KEY (`tid`),

    KEY `topic_firstpost` (`topic_firstpost`),

    KEY `last_post` (`forum_id`,`pinned`,`last_post`),

    KEY `forum_id` (`forum_id`,`pinned`,`approved`),

    KEY `starter_id` (`starter_id`,`forum_id`,`approved`),

    KEY `last_post_sorting` (`last_post`,`forum_id`),

    FULLTEXT KEY `title` (`title`)

    ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8

    )

  4. Array

    (

    [tid] => 3

    [title] => PieteikÅ¡anÄs 11. NHL turnÄ«ram.

    [description] =>

    [state] => open

    [posts] => 9

    [starter_id] => 7

    [start_date] => 1264430287

    [last_poster_id] => 6

    [last_post] => 1264438994

    [icon_id] => 0

    [starter_name] => xxx

    [last_poster_name] => xxx

    [poll_state] => 0

    [last_vote] => 0

    [views] => 59

    [forum_id] => 4

    [approved] => 1

    [author_mode] => 1

    [pinned] => 0

    [moved_to] =>

    [total_votes] => 0

    [topic_hasattach] => 0

    [topic_firstpost] => 5

    [topic_queuedposts] => 0

    [topic_open_time] => 0

    [topic_close_time] => 0

    [topic_rating_total] => 0

    [topic_rating_hits] => 0

    [title_seo] => pieteiksanas-11-nhl-turniram

    [seo_last_name] =>xxx

    [seo_first_name] => xxx

    )

  5. Man tas kods ir domāts kā include.

    kautko uzmālēju bet burti kā nau tā nau.

     

    <b><tr class="sectiontableentry1"><td align="left" height="20">
    						<?
    
     						$db_host = 'localhost';
    $db_user = 'xxxx';
    $db_password = 'xxx';
    $db_name = 'xxx';
    
    $connection = @mysql_connect($db_host, $db_user, $db_password) or die(mysql_error());
    mysql_select_db($db_name, $connection);
    mysql_set_charset('utf8',$connection); 
    
    
    
    
    						$result1 = mysql_query("SELECT * FROM ipb_topics ORDER BY `ipb_topics`.`last_post` DESC LIMIT 0,1 ");
    $row1 = mysql_fetch_assoc($result1);
    
    $title = $row1['title'];
    $id = $row1['tid'];
    $posts = $row1['posts'];
    utf8_encode($title);
    
    ?>
    
    <b><a href="forum//index.php?/topic/<? echo $id; ?>-<? echo $title; ?>/"><? echo $title; ?></a> 
    <?
    if($title != ''){
    echo "[";
    echo $posts;
    echo "]";
    }
    ?>
    </b></td></tr>

  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//LV" "http://www.w3.org/TR/html4/loose.dtd">
    
    
    	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
                  <meta http-equiv="Content-Language" content="lv" />
    
    <b><tr class="sectiontableentry1"><td align="left" height="20">
    						<?
    
     						$db_host = 'localhost';
    $db_user = 'userpass';
    $db_name = 'db';
    
    $connection = @mysql_connect($db_host, $db_user, $db_password) or die(mysql_error());
    mysql_select_db($db_name, $connection);
    
    
    						$result1 = mysql_query("SELECT * FROM ipb_topics ORDER BY `ipb_topics`.`last_post` DESC LIMIT 0,1 ");
    $row1 = mysql_fetch_assoc($result1);
    
    $title = $row1['title'];
    $id = $row1['tid'];
    $posts = $row1['posts'];
    ?>
    
    <b><a href="forum//index.php?/topic/<? echo $id; ?>-<? echo $title; ?>/"><? echo $title; ?></a> 
    <?
    if($title != ''){
    echo "[";
    echo $posts;
    echo "]";
    }
    ?>
    </b></td></tr>

    Mani ir šāds kods mainu ko gribu ķeburi paliek..

×
×
  • Create New...