Anonymní profil noro – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Anonymní profil noro – Programujte.comAnonymní profil noro – Programujte.com

 

Příspěvky odeslané z IP adresy 178.41.81.–

noro
CSS › Zmena rozlisenia, zachovanie…
5. 1. 2016   #207759

#4 peter
Prečo chceš nastaviť veľkosť ? prečo nenastavíš na 100percent?   Stránka sa prispôsobuje veľkosti okna.

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body {
    font-family: "Lucida Sans", Verdana, sans-serif;
}

.main img {
    width: 100%;
}

h1{
    font-size: 1.625em;
}

h2{
    font-size: 1.375em;
}

.header {
    padding: 1.0121457489878542510121457489879%;
    background-color: #f1f1f1;
    border: 1px solid #e9e9e9;
}

.menuitem {
    margin: 4.310344827586206896551724137931%;
    margin-left: 0;
    margin-top: 0;
    padding: 4.310344827586206896551724137931%;
    border-bottom: 1px solid #e9e9e9;
    cursor: pointer;
}

.main {
    padding: 2.0661157024793388429752066115702%;
}

.right {
    padding: 4.310344827586206896551724137931%;
    background-color: #CDF0F6;
}

.footer {
    padding: 1.0121457489878542510121457489879%;
    text-align: center;
    background-color: #f1f1f1;
    border: 1px solid #e9e9e9;
    font-size: 0.625em;
}

.gridcontainer {
    width: 100%;
}

.gridwrapper {
    overflow: hidden;
}

.gridbox {
    margin-bottom: 2.0242914979757085020242914979757%;
    margin-right: 2.0242914979757085020242914979757%;
    float: left;
}

.gridheader {
    width: 100%;
}

.gridmenu {
    width: 23.481781376518218623481781376518%;
}

.gridmain {
    width: 48.987854251012145748987854251012%;
}

.gridright {
    width: 23.481781376518218623481781376518%;
    margin-right: 0;
}

.gridfooter {
    width: 100%;
    margin-bottom: 0;
}

@media only screen and (max-width: 500px) {
    .gridmenu {
        width: 100%;
    }

    .menuitem {
        margin: 1.0121457489878542510121457489879%;
        padding: 1.0121457489878542510121457489879%;
    }

    .gridmain {
        width: 100%;
    }

    .main {
        padding: 1.0121457489878542510121457489879%;
    }

    .gridright {
        width: 100%;
    }

    .right {
        padding: 1.0121457489878542510121457489879%;
    }

    .gridbox {
        margin-right: 0;
        float: left;
    }
}

</style>
</head>
<body>
<div class="gridcontainer">
    <div class="gridwrapper">
        <div class="gridbox gridheader">
            <div class="header">
                <h1>The Pulpit Rock</h1>
            </div>
        </div>
        <div class="gridbox gridmenu">
            <div class="menuitem">The Drive</div>
            <div class="menuitem">The Walk</div>
            <div class="menuitem">The Return</div>
            <div class="menuitem">The End</div>
        </div>
        <div class="gridbox gridmain">
            <div class="main">
<h1>The Walk</h1>
<p>The walk to the Pulpit Rock will take you approximately two hours, give or take an hour depending on the weather conditions and your physical shape.</p>
<img src="pulpitrock.jpg" alt="Pulpit rock" width="" height="">

            </div>
        </div>
        <div class="gridbox gridright">
            <div class="right">
<h2>What?</h2>
<p>The Pulpit Rock is a part of a mountain that looks like a pulpit.</p>
<h2>Where?</h2>
<p>The Pulpit Rock is in Norway</p>
<h2>Price?</h2>
<p>The walk is free!</p>
            </div>
        </div>
        <div class="gridbox gridfooter">
            <div class="footer">
<p>This web page is a part of a demonstration of fluid web design made by www.w3schools.com. Resize the browser window to see the content response to the resizing.</p>
            </div>
        </div>
    </div>
</div>
</body>
</html>

noro
CSS › Zmena rozlisenia, zachovanie…
5. 1. 2016   #207754

Pozri si túto stránku   http://www.w3schools.com/cssref/css3_pr_mediaquery.asp

noro
PHP › FILES
5. 1. 2016   #207752

#6 Kit

Už mi to funguje zmenil som $savefolder = "images"; na

$savefolder =  "c:/uploads/"; Len sa mi nezobrazuje obrázok  


//index.html


<!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>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" rel="nofollow" href="style.css" />
<script type="text/javascript" src="xmlhttp.js"></script>
<script type="text/javascript" src="functions.js"></script>
</head>
<body>
<div id="showimg"></div>
<form id="uploadform" action="process_upload.php" method="post" enctype="multipart/form-data" target="uploadframe">
Upload a File:<br />
<input type="file" id="myfile" name="myfile" />
<input type="submit" value="Submit" onclick="uploadimg(document.getElementById('uploadform')); return false;" />
<iframe id="uploadframe" name="uploadframe" src="process_upload.php" class="noshow"></iframe>
</form>
</body>
</html>

//process_upload.php

<?php
//process_upload.php

//Allowed file mime types.
$allowedtypes = array ("image/jpeg","image/pjpeg","image/png","image/gif");
//Where we want to save the file to.
$savefolder = "images";

/*
//First, kill off all older files.
if (is_dir ($savefolder)){
$scanarray = scandir ($savefolder);
$numdirs = count ($scanarray);
//parse the array
for ($i = 0; $i < $numdirs; $i++){
// make sure it is not the '.' or '..' files
if ($scanarray[$i] != "." && $scanarray[$i] !="..") {
//make sure it's a file
if (is_file ($savefolder . "/" . $scanarray[$i])){
unlink ($savefolder . "/" . $scanarray[$i]);
}
}
}
}
*/

//If we have a valid file.
if (isset ($_FILES['myfile'])){
//Then we need to confirm it is of a file type we want.
if (in_array ($_FILES['myfile']['type'],$allowedtypes)){
//Then we can perform the copy.
if ($_FILES['myfile']['error'] == 0){
$thefile = $savefolder . "/" . $_FILES['myfile']['name'];
if (!move_uploaded_file ($_FILES['myfile']['tmp_name'], $thefile)){
echo "There was an error uploading the file.";
} else {
//Signal the parent to load the image.
?>
<!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>
<script type="text/javascript" src="functions.js"></script>
</head>
<body>
<img src="<?=$thefile?>" onload="doneloading (parent,'<?=$thefile?>')" />
</body>
</html>
<?php
}
}
}
}
?>

// other functions to save into functions.js

//functions.js

//Function to determine when the process_upload.php file has finished executing.
function doneloading(theframe,thefile){
var theloc = "showimg.php?thefile=" + thefile
theframe.processajax ("showimg",theloc);
}

function uploadimg (theform){
//Submit the form.
theform.submit();
//Then display a loading message to the user.
setStatus ("Loading...","showimg");
}

//Function to set a loading status.
function setStatus (theStatus, theObj){
obj = document.getElementById(theObj);
if (obj){
obj.innerHTML = "<div class=\"bold\">" + theStatus + "</div>";
}
}

function changesize (img, sml){
//The display a loading message to the user.
theobj = document.getElementById("showimg");
if (theobj){
setStatus ("Loading...","showimg");
var loc = "thumb.php?img=" + img + "&sml=" + sml;
processajax ("showimg",loc);
}
}

Posted on 26 Oct 2009, 22:01 - Category: AJAX
Comments - Edit - Delete
 

AJAX xmlhttp.js get or post include

//Just save, upload, include
//xmlhttp.js

//Function to create an XMLHttp Object.
function getxmlhttp (){
//Create a boolean variable to check for a valid microsoft active X instance.
var xmlhttp = false;

//Check if we are using internet explorer.
try {
//If the javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using internet explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-internet explorer browser.
xmlhttp = false;
}
}

//If we are using a non-internet explorer browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}

return xmlhttp;
}

//Function to process an XMLHttpRequest.
function processajax (serverPage, obj, getOrPost, str){
//Get an XMLHttpRequest object for use.
xmlhttp = getxmlhttp ();
if (getOrPost == "get"){
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
xmlhttp.open("POST", serverPage, true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(str);
}
}

noro
PHP › FILES
4. 1. 2016   #207739

ďakujem ide to 'C:/uploads/'

noro
PHP › FILES
4. 1. 2016   #207736

Skúšal som to upraviť aj ja som to vydel ,ale keď som to upravil tak to bolo také isté:

1, $uploaddir = '/uploads/';

2, $uploaddir = 'www/uploads/';

noro
PHP › FILES
4. 1. 2016   #207733

Prosím Vás čo tu mám za chybu:

-Warning: move_uploaded_file(/var/www/uploads/14.png): failed to open stream: No such file or directory in

-Warning: move_uploaded_file(): Unable to move 'C:\wamp\tmp\php20E5.tmp' to '/var/www/uploads/14.png' in

<form enctype="multipart/form-data" action="pok2.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="512000" />
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
</form>

<?php

    $uploaddir = '/var/www/uploads/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

    echo "<p>";

    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
      echo "File is valid, and was successfully uploaded.\n";
    } else {
       echo "Upload failed";
    }

    echo "</p>";
    echo '<pre>';
    echo 'Here is some more debugging info:';
    print_r($_FILES);
    print "</pre>";

    ?>

 

Výsledok

Upload failed
Here is some more debugging info:Array ( [userfile] => Array ( [name] => 14.png [type] => image/png [tmp_name] => C:\wamp\tmp\php20E5.tmp [error] => 0 [size] => 369477 ) )
 

noro
MySQL › try { smth } catch {
4. 1. 2016   #207732

ďakujem za odpoveď len som to našiel ne jednej stránke.  PDO funkciami nemám skúsenosti ale čo som potreboval našiel som na jednej stránke :http://code.tutsplus.com/…y--net-25338 .Nič lepšie som nenašiel.

noro
MySQL › try { smth } catch {
2. 1. 2016   #207684

#33 Kit
Prosím Vás a ako môžem zobraziť celú DB ? Takto sa mi to podarilo poskladať len sa to zobrazuje po jednom.

$query = $db->prepare("SELECT content FROM block  ORDER BY RAND() LIMIT 1");
$query->execute(array(':block'));
 
   $i=0;
   while ($row = $query ->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)){
 
    echo $row[$i] . "\n";$i++;
 }

noro
MySQL › try { smth } catch {
31. 12. 2015   #207662

ďakujem ide to

noro
MySQL › try { smth } catch {
31. 12. 2015   #207655

Skúšal som to aj takto. Nepíše to chybu ale ani žiadne hlásenie aj keď je tam správne meno čo je DB

$lowerCaseString = strtolower($_GET['sstring']);
$stmt =( $db->prepare("SELECT user_id  FROM users WHERE user_name =$lowerCaseString"));
while ($row =$stmt->fetch(PDO::FETCH_ASSOC)) {
    echo $row['user_name'] . $lowerCaseString."<br>";
}

Neni tam nijaká chyba?

noro
MySQL › try { smth } catch {
31. 12. 2015   #207653

Má zistiť či je db. Požadované meno alebo neni. Či že jeden záznam.

noro
MySQL › try { smth } catch {
31. 12. 2015   #207650

#25 Kit

Takt som to našiel aj ja na internete, ale ja som práve if a else chcel použiť ale nikde som to nenašiel len takto:


$db = opendatabase();
//Set up the dynamic query string.
$querystr = "SELECT userid FROM user WHERE name =
LOWER('" . mysql_real_escape_string ( $_GET['sstring']) . "')";
if ($userquery = mysql_query ($querystr)){
if (mysql_num_rows ($userquery) == 0){
//Then return with an error.
?><span style="color: #FF0000;">Name not found...</span><?php
} else {
//At this point we would go to the processing script.
?><span style="color: #FF0000;">Form would now submit...</span><?php
}
} else {
echo mysql_error();
}

Ale pre PDO som nenašiel. Neviem to dokončiť

noro
MySQL › try { smth } catch {
31. 12. 2015   #207647

#23 Kit
$successfullyExecuted som robil podľa Ondreja. Dal som to preč ale teraz sa mi zobrazuje len čo je za else:


$db = opendatabase();
$lowerCaseString = strtolower($_GET['sstring']);


$stmt =( $db->prepare("SELECT user_id  FROM users WHERE user_name =$lowerCaseString"));


if ($stmt  === 0){

while ($row =$stmt->fetch())
    //Then return with an error.
?><span style="color: #FF0000;">Name not found...</span><?php
        // work with the $row variable
    
}
else {
//At this point we would go to the processing script.
?><span style="color: #FF0000;">Form would now submit...</span><?php
}
?>

noro
MySQL › try { smth } catch {
30. 12. 2015   #207623

#21 ondrej39

Ďakujem Si super!!!!  funguje to. A na konci to netreba zatvoriť?

ukončil som to takto:

$lowerCaseString = strtolower($_GET['sstring']);

$querystr = $db->prepare("SELECT user_id  FROM users WHERE user_name = ?");
$successfullyExecuted = $querystr->execute([
    $lowerCaseString,
]);

if ($successfullyExecuted === true) {
    while ($row = $querystr->fetch()) {
    //Then return with an error.
?><span style="color: #FF0000;">Name not found...</span><?php
        // work with the $row variable
    }
}
else {
//At this point we would go to the processing script.
?><span style="color: #FF0000;">Form would now submit...</span><?php
}

Toto Dostávam na konci:

Name not found...Form would now submit... Name not found...Name not found...Form would now submit...

noro
MySQL › try { smth } catch {
30. 12. 2015   #207621

Pohlo sa to ďakujem .

Select má vyzerať nijak takto?

$querystr = $conn->prepare("SELECT userid FROM user WHERE name =LOWER(" .  $db->quote( $_GET['sstring']) . ")");

noro
MySQL › try { smth } catch {
30. 12. 2015   #207616

A keď tam dám mysqli

-Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'

-PDOException: could not find driver

noro
MySQL › try { smth } catch {
30. 12. 2015   #207615

Aj tak som to mal mám tam ďalšie hlásenie

Deprecated: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

noro
MySQL › try { smth } catch {
30. 12. 2015   #207612


<?php
$host = "localhost";
$user = "user";
$password = "";
$db = "test";

function opendatabase() {
     $options = array(
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
    );
    $dsn = "mysq:host=localhost;dbname=test";
    $db =  new PDO($dsn, 'user', '', $options);
    return $db;
$db->close();
}
?>

Skúšal som vrchný kód dostal som hlásenie:

-Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in

-PDOException: could not find driver in

Stále tam je nijaký problém potrebujem niečo nainštalovať?

noro
MySQL › try { smth } catch {
30. 12. 2015   #207610

#9 noro
A prečo sa píš niekedy mysql a niekedy mysqli?

noro
MySQL › try { smth } catch {
30. 12. 2015   #207608

#8 Kit
A aký program požuváte? Ja používam text editor. S programami som mal problém, veľa veci čo som chcel sa my písane v programoch sa mi nezobrazovalo. A text editore nebol problém. Neviem prečo

noro
MySQL › try { smth } catch {
29. 12. 2015   #207595

#4 Kit
Ďakujem popozerám to. Problém je v tom že každý požuvá inakší zápis.

noro
MySQL › try { smth } catch {
29. 12. 2015   #207591

#2 ďakujem, mám dalšie hlasenie

Warning: mysql_select_db() expects parameter 2 to be resource, object given in

noro
MySQL › try { smth } catch {
29. 12. 2015   #207588

Dobý deň,  prosím Vás kde mám chybu dostávam hlásenie:Parse error: syntax error, unexpected 'catch' (T_CATCH)

function opendatabase(){
$db =mysqli_connect(MYSQLHOST,MYSQLUSER,MYSQLPASS) or die(mysql_error());
try {
    if (!$db){
        $exceptionstring = "Error connecting to database: <br />";
        $exceptionstring .= mysql_errno() . ": " . mysql_error();
        throw new exception ($exceptionstring);
    } else {   
        mysql_select_db("test",$db) or die(mysql_error());
        return $db;
    } catch (Exception $e) {
        echo $e->getmessage();
        die();
    }
}

 

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032021 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý