Results 1 to 16 of 16

Thread: PHP/MySQL

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Mar:2013
    Location: Sofia
    Posts: 33

    Question PHP/MySQL

    ,

    3 PHP MySQL HTML CSS . . (UDK - Unreal Development Kit), . PHP .


    :
    PHP Code:
    <?php require_once("includes/connection.php"); ?>
    <?php 
    require_once("includes/header.php"); ?>
    <form action="add_new.php" method="POST">
        Subject: <input type="text" name="heading" value="" /><br />
        Body message:<br /> 
        <textarea id="new_message_form" name="message" rows="20" cols="80" ></textarea><br />
        <input type="submit" name="submit" value="Submit!" /><br />
    </form>
    <?php require_once("includes/footer.php"); ?>
    :
    PHP Code:
    <?php require_once("includes/connection.php"); ?>
    <?php
        $heading 
    $_POST['heading'];
        
    $message $_POST['message'];
        
        
    $sql "INSERT INTO news (new_heading, new_message, date)
                VALUES ('
    {$heading}', '{$message}', CURDATE())";
                
        
    $result mysql_query($sql$conn);
        
        if(!
    $result) {
            echo 
    "Failed to add new: " mysql_error();
        } else {
            echo 
    "Successfully added new. <br />";
            echo 
    "<a href=\"news.php\">See news</a>";
        }
    ?>
    3 :
    PHP Code:
     <?php
        $sql 
    "SELECT * FROM news ORDER BY id DESC LIMIT 3";
        
            
    $result mysql_query($sql$conn);
        
            while(
    $row mysql_fetch_array($result)) {
                echo 
    "<h2>Current News</h2>"
                echo 
    "<table border=\"2\" width=\" 400 \" height=\" auto \">";
                echo 
    "<tr><td><span class=\"mes_head\">{$row['new_heading']}</span></td> 
                          <td><span class=\"mes_head\">
    {$row['date']}</span></td></tr>"//Date and Heading
                
    echo "<tr><td colspan=\"2\"><span id=\"mes_body\">{$row['new_message']}</span</td></tr>";
                echo 
    "</table>";
            }
            
            echo 
    "<a href=\"add_new_form.php\">Add new entry</a>";
    ?>
    "Enter"- .
    . :
    Thing to create:
    *Create source code for the game
    *Create a map
    *Create weapons
    *Create player model
    *Create bot models

    Developing the game on:
    Unreal Development Kit(UDK)
    , "Enter"-? , Google 3 "", .

    , : , html ? HardwareBG(, , , ). , .

  2. #2
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    , - , .

    - ""- - <br>, ... .

    . . 3 , . , .
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  3. #3
    Registered User
    Join Date: Mar:2013
    Location: Sofia
    Posts: 33
    . , . . 2 , Lynda.com. . . . , nl2br($string);. , . .

    index.php . , . .. .
    ALL GREAT THINGS ARE SIMPLE AND MANY CAN BE EXPRESSED IN SINGLE WORDS:
    FREEDOM, JUSTICE, HONOR, DUTY, MERCY, HOPE.
    Winston Churcill

  4. #4
    Registered User hateras's Avatar
    Join Date: Jan:2011
    Location: Kronos III
    Posts: 1,028
    - / -/ :
    Code:
    echo "<tr><td colspan=\"2\"><span id=\"mes_body\"><pre>{$row['new_message']}</pre></span</td></tr>";
    [Enter]-.
    PHP- EOL <br>
    ASRock B550M Pro 4; Ryzen R5 3600; 2x16 GiB G.SKILL Aegis 3200; 1TB Samsung QVO 960 + 3TB Seagate IronWolf; Zalman Z1

  5. #5

    Join Date: Apr:2006
    Location:
    Posts: 8,666
    Quote Originally Posted by hateras View Post
    - / -/ :
    , .

    http://www.php.net/manual/en/faq.gen...q.general.what
    What does PHP stand for?

    PHP stands for PHP: Hypertext Preprocessor.

  6. #6
    ! vbTheKing's Avatar
    Join Date: Sep:2003
    Location:
    Posts: 4,138
    HTML-a nl2br() .
    POST - mysql_real_escape_string SQL Injection
    ''? * *
    - !
    ...

  7. #7
    Registered User
    Join Date: Mar:2013
    Location: Sofia
    Posts: 33
    Quote Originally Posted by OzoneBG View Post
    . , nl2br($string);.
    , .

    10 , ? Google , .

    :
    PHP Code:
    $snip ''
    $full ''

    if (
    $result mysql_query('SOME QUERY TO GET VALUE')) { 
         
    $row mysql_fetch_row($result); 
         
    $full $row[0]; 
         if (
    strlen($full) > 60) { 
              
    $snip substr(060) . ' (More)...'
         } else { 
              
    $snip $full
         } 

    ALL GREAT THINGS ARE SIMPLE AND MANY CAN BE EXPRESSED IN SINGLE WORDS:
    FREEDOM, JUSTICE, HONOR, DUTY, MERCY, HOPE.
    Winston Churcill

  8. #8

    Join Date: Apr:2006
    Location:
    Posts: 8,666
    , PDO.
    - explode(" ", $string, 10) 10, .

    php.net , !

  9. #9
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    :

    function substr_word($txt, $length, $offset = 0) {
    return trim(mb_substr($txt, $offset, mb_strpos($txt, ' ', $offset + $length, 'UTF-8'), 'UTF-8'));
    }
    $length. , substr UTF-8 .

    html , overflow: hidden; word-wrap: break-word; width, height . "", .

    Edit: , word-wrap: break-word;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |