Jump to content

JankaZ

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JankaZ's Achievements

Member

Member (2/5)

0

Reputation

  1. Can someone please help with vote script. I pres button and vote for song and its count to thats song id! <table border=1> <tr> <th>Nr</th> <th>Albums</th> <th>Izpilditajs</th> <th>Dziesma</th> </tr> <?php $con = mysql_connect("localhost","root","1991jz9969470"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("top", $con); //Izveido query $query = mysql_query("select * from top"); //dabu visus datus no db while ($row = mysql_fetch_array($query)){ $id = $row['id']; $albums = $row['albums']; $izpilditajs = $row['izpilditajs']; $dziesma = $row['dziesma']; ?> <tr> <th><?php echo $id;?></th> <th><?php echo $albums;?></th> <th><?php echo $izpilditajs;?></th> <th><?php echo $dziesma;?></th> </tr> <?php } //If beigu zime ?>
  2. I nide example script becose im beginer!
  3. How ken I simple protect my page with password. All time when I open for example song.php they askk enter password I enter pasword then shows all other stof in song.php file!
  4. Im nowbie here ken you fix my code and there nide else to i think dat! else echo song add tnx!
  5. How ken i make to script chect a song if its nat in db if its is than drop error song alredy exist! Albums=album dziesma=song izpilditajs=artis And i nide to check if posted song nat in db else post error song alredy posted. PLZZZ help. <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("top", $con); $sql="INSERT INTO top (albums, izpilditajs, dziesma) VALUES ('$_POST[albums]','$_POST[izpilditajs]','$_POST[dziesma]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Paldies tava dziesma ir pievienota."; mysql_close($con) ?>
  6. Kan you give simple code example becose im beginer!
  7. Jes its like I nide! But how ken i put to echo only 10 lines! <?php // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. $lines = file('http://www.example.com/'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; } // Another example, let's get a web page into a string. See also file_get_contents(). $html = implode('', file('http://localhost/bot/')); // Using the optional flags parameter since PHP 5 $trimmed = file('atbildes.php', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); ?>
  8. Plzz somebody show code how to get for example 10 lines from php file. Read line from php file is same like text file. I how chat bot and it save all talk and i vana echo last 10 lines For example: Me: Hello<br/> Bot: Hi<br/> Me: how ar you?<br/> Bot: Nice!<br/> Me: Version<br/> Bot: V.1<br/> Me: Nice day!<br/> Bot: Jes.<br/> Me: By.<br/> Bot: By!<br/> And all time show now lines ad i whana echo 10 lines to user ken see! Plzz somebody show code or help!
  9. Jes Table bot Rows id jautajums atbilde id=id jautajums=question atbilde=answer
  10. Tnxx Cookie for you! +1 But I am beginer and finde your whine smal mistake Behaind you nide to put synatx ; But tnx alot. Ken you tel me how to make this Me: Versija Bot: V.1 Me: Hello Bot: Hi To save a histori and show for example 5~10 posts!
  11. I corectli place that code? <form method="post"> Jautajums: <input name="jautajums" type="text" /> <input type="submit" value="Jautat" /> <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("db") or die(mysql_error()); $Q = mysql_query("SELECT * FROM bot") or die(mysql_error()); if($_POST['jautajums']) // vai formas name { $Q = mysql_real_escape_string($_POST['jautajums']); // drosiba pirmajaa vietaa $result= mysql_query("SELECT count(atbilde) AS c, atbilde FROM bot WHERE jautajums = '".$Q."' GROUP BY atbilde"); if($result && mysql_num_rows($result) > 0) { // if the query did not fail, and there was at least 1 row returned $atbilde = mysql_fetch_assoc($result); { echo "Nesapratu jautajumu"; } { echo $atbilde['atbilde']; } ?> I hawe error with unspected $end! In thats line is only ?>
  12. Error Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in D:\web\www\bot\bot.php on line 11 Script <form method="post"> Jautajums: <input name="jautajums" type="text" /> <input type="submit" value="Jautat" /> <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("db") or die(mysql_error()); $Q = mysql_query("SELECT * FROM bot") or die(mysql_error()); if($_POST['jautajums']) // vai formas name { $Q = mysql_real_escape_string($_POST['jautajums']); // drosiba pirmajaa vietaa $atbilde = mysql_fetch_assoc("SELECT count(atbilde) AS c, atbilde FROM bot WHERE jautajums = '".$Q."' GROUP BY atbilde"); if($atbilde['c'] < 1) { echo "Nesapratu jautājumu"; } else { echo $atbilde['atbilde']; } } ?>
  13. plzz ken you fix it or give som example!
  14. <form method="post"> Jautajums: <input name="jautajums" type="text" /> <input type="submit" value="Jautat" /> <?php $conectdb = mysql_connect("localhost","root","1991jz9969470"); if (!$conectdb) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db", $conectdb); $atbilde = mysql_result(mysql_query("SELECT atbilde FROM bot WHERE jautajums='".$_POST['jautajums']."'")); echo $atbilde; ?> <br /> <? echo("Tu: $jautajums"); ?> <br /> <? echo("Bots: $atbilde"); ?> Plzz help with this error jautajums = question atbilde = answer
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.