Snaip3Rs Posted April 11, 2010 Author Report Share Posted April 11, 2010 (edited) Šādi? Negribās megināt jo ja nebūs pareizi atkal servers nobruks! :( <?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']; } } ?> Ieliku mysql query tikai nezinu vai pareizi! Edited April 11, 2010 by Snaip3Rs Quote Link to comment Share on other sites More sharing options...
briedis Posted April 11, 2010 Report Share Posted April 11, 2010 Varbūt vienkārši uzliec normālu webserveri? Es lietoju xampp, nokāries ir kādas divas reizes gada laikā, un tikai tad, kad veicu dažādas izvirtības... Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 11, 2010 Report Share Posted April 11, 2010 start->all programs->appserv->error.log Quote Link to comment Share on other sites More sharing options...
Snaip3Rs Posted April 11, 2010 Author Report Share Posted April 11, 2010 [sun Apr 11 08:47:20 2010] [warn] pid file D:/web/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0 [sun Apr 11 08:47:37 2010] [notice] Apache/2.2.8 (Win32) PHP/6.0.0-dev configured -- resuming normal operations [sun Apr 11 08:47:37 2010] [notice] Server built: Jan 18 2008 00:37:19 [sun Apr 11 08:47:37 2010] [notice] Parent: Created child process 1940 PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0 [sun Apr 11 08:47:51 2010] [notice] Child 1940: Child process is running [sun Apr 11 08:47:51 2010] [notice] Child 1940: Acquired the start mutex. [sun Apr 11 08:47:51 2010] [notice] Child 1940: Starting 64 worker threads. [sun Apr 11 08:47:51 2010] [notice] Child 1940: Starting thread to listen on port 80. [sun Apr 11 09:55:07 2010] [error] [client 127.0.0.1] File does not exist: D:/web/www/favicon.ico [sun Apr 11 09:55:11 2010] [error] [client 127.0.0.1] File does not exist: D:/web/www/favicon.ico [sun Apr 11 11:24:36 2010] [error] [client 127.0.0.1] File does not exist: D:/web/www/favicon.ico [sun Apr 11 11:24:39 2010] [error] [client 127.0.0.1] File does not exist: D:/web/www/favicon.ico [sun Apr 11 11:26:58 2010] [notice] Parent: child process exited with status 3221225477 -- Restarting. PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0 [sun Apr 11 11:27:14 2010] [notice] Apache/2.2.8 (Win32) PHP/6.0.0-dev configured -- resuming normal operations [sun Apr 11 11:27:14 2010] [notice] Server built: Jan 18 2008 00:37:19 [sun Apr 11 11:27:14 2010] [notice] Parent: Created child process 3108 PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0 [sun Apr 11 11:27:15 2010] [notice] Child 3108: Child process is running [sun Apr 11 11:27:15 2010] [notice] Child 3108: Acquired the start mutex. [sun Apr 11 11:27:15 2010] [notice] Child 3108: Starting 64 worker threads. [sun Apr 11 11:27:15 2010] [notice] Child 3108: Starting thread to listen on port 80. Quote Link to comment Share on other sites More sharing options...
briedis Posted April 11, 2010 Report Share Posted April 11, 2010 It kā nekas traks, bet varētu lēnām sākt ar šo te labošanu: PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0 PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0 Quote Link to comment Share on other sites More sharing options...
Snaip3Rs Posted April 11, 2010 Author Report Share Posted April 11, 2010 PhP 6 vēl tikai izstrādes stadijā tāpēc labāk uzliku atpakaļ PhP 5 Un tagad gan uzmet error nevis nograujās serveris! Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in D:\web\www\bot\bot.php on line 11 Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 11, 2010 Report Share Posted April 11, 2010 11.linija ir taču echo "Nesapratu jautājumu"; ^^ Quote Link to comment Share on other sites More sharing options...
briedis Posted April 11, 2010 Report Share Posted April 11, 2010 PhP 6 vēl tikai izstrādes stadijā tāpēc labāk uzliku atpakaļ PhP 5 Un tagad gan uzmet error nevis nograujās serveris! Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in D:\web\www\bot\bot.php on line 11 register_globas ir visai stulba lieta, tā kā to vajadzētu norubīt tāpat... Kļūda kvērijā. Quote Link to comment Share on other sites More sharing options...
Snaip3Rs Posted April 11, 2010 Author Report Share Posted April 11, 2010 Ne uz 11 man nau echo jo formu ar vajag lai jautājumu varētu uzdot! Kods <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']; } } ?> 11.Rinda $atbilde = mysql_fetch_assoc("SELECT count(atbilde) AS c, atbilde FROM bot WHERE jautajums = '".$Q."' GROUP BY atbilde"); Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted April 11, 2010 Report Share Posted April 11, 2010 Paskaties vispirms kas jāpadod tam mysql_fetch_assoc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.