JankaZ
Members-
Posts
30 -
Joined
-
Last visited
Never
Everything posted by JankaZ
-
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 ?>
-
I nide example script becose im beginer!
-
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!
-
Im nowbie here ken you fix my code and there nide else to i think dat! else echo song add tnx!
-
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) ?>
-
Kan you give simple code example becose im beginer!
-
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); ?>
-
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!
-
Jes Table bot Rows id jautajums atbilde id=id jautajums=question atbilde=answer
-
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!
-
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 ?>
-
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']; } } ?>
-
I dont ander stand it!
-
plzz ken you fix it or give som example!
-
<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
-
I make db bot id | message | return Conect to db! And how ken i get answer from db and ask message. <form method="post"> message: <input name="message" type="text" /> <input type="submit" value="ask" /> And i write hello he conect to db and serch for answer and if answer is than hello else in db not that answer. Plzz somebody giv som example of that script!
-
how ken i place in this script to show history?
-
How ken i show post histori to 10 posts for example! You: Hello Bot: Hi You: Nice day Bot: Jes <form method="post"> Message: <input name="message" type="text" /> <br /> <input type="submit" value="Send Message" /> <?php $name =$_POST['name']; $message =$_POST['message']; if ( $message == "hello") { $return = "how are you?"; } if ($message == "good you?") { $return = "i am good"; } if ($message == "good") { $return = "thats cool"; } if ($message == "sad") { $return = "well why are u sad"; } if ($message == "sad you?") { $return = "im good, and why so sad?"; } if ($message == "fine") { $return = "fine, usually that measn your bored!"; } if ($message == "fine you?") { $return = "im good"; } ?> <br /> <? echo("$return"); ?> And ken i store questions and answers in txt file? if ken then how?
-
Ken sombodi give script for ansver bot! I: Hello! Bot: Hi! I: Where i em? Bot: phpfreaks.com! I: By Bot: Tnx for wisite phpfreaks.com Form example questions and ansvers ken store in ansvers.txt or someor else! And if not ansver! He seys I dont got so meny ansvers!
-
Sory for Double post. But plzz help I newbie and whant make this script and lern mor! And sory for Bad English Im from Lavia
-
1.Table Users Rows 2.And ken you upgrade my loigin page plzzz <?php if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username'])) { ?> <?php } elseif(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'"); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_array($checklogin); $email = $row['EmailAddress']; $_SESSION['Username'] = $username; $_SESSION['EmailAddress'] = $email; $_SESSION['LoggedIn'] = 1; echo "<h1>Veiksmīgi</h1>"; echo "<p>Mēs tevi pārsūtam uz profila lapu.</p>"; echo "<meta http-equiv='refresh' content='=2;index.php' />"; } else { echo "<h1>Kļūda</h1>"; echo "<p>Atvaino tavs profils netika atrasts <a href=\"login.php\">Mēģini vēlreiz</a>.</p>"; } } else { ?> <form method="post" action="login.php" name="loginform" id="loginform"> <fieldset> <label for="username">Tavs lietotajvards</label><br /> <input type="text" name="username" id="username" /><br /> <label for="password">Tava parole</label><br /> <input name="password" type="password" id="password" /><br /> <input type="submit" name="login" id="login" value="Ienākt" /> <INPUT TYPE="BUTTON" VALUE="Reģistrēties" ONCLICK="window.location.href='register.php'"> </fieldset> </form> <?php } ?> If someone not loged in show login else redirect to home.php 3.And what i nide to place in home.php if someone not logen in then dont show page but redirect to login.php
-
Seim error Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/lockerz/public_html/projekts/index.php on line 15 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/lockerz/public_html/projekts/index.php on line 16 <?php include "base.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Profils</title> </head> <body> <php $username=$_SESSION['username']; // also remember to escape $vars that go into SQL: $username = mysql_real_escape_string($username); $sql="SELECT * FROM USERS WHERE username='$username'"; $result=mysql_query($sql, $db); while $row=mysql_fetch_array($result)) { echo "<img src=".$imgurl."/>"; } ?> <p>Sveiks<b> <?=$_SESSION['Username']?><b>. <a href="logout.php">Iziet.</a></p>
-
Agen ERROR Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/lockerz/public_html/projekts/index.php on line 12 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/lockerz/public_html/projekts/index.php on line 13 $sql="SELECT * FROM USERS WHERE username=$username"; $result=mysql_query($sql, $db);
-
Nothing hapen seim ERROR "; } ?> Sveiks Test. Iziet.