Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][MYSQL]Bład podczas rejestracji
dakipl
post 1.06.2009, 12:39:11
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.09.2007

Ostrzeżenie: (0%)
-----


Wiram mam na serwerze wrzucony licznik sciągniety z http://www.eyesis.ca/projects/fwc.html

Podczas dodawania urzytkownika wystepuje błąd
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/dakipl/www/dakipl.host4u.pl/class.dbmysql.php on line 83
czyli

  1. <?php
  2. // Count number of rows in a result
  3. function countRows($q)
  4. {
  5.  $this->resCalc($q);
  6.  return (int) mysql_num_rows($q);
  7. }
  8. ?>

dostosowałem w configu dostep do bazy danych

  1. <?php
  2. /* DATABASE ADAPTER */
  3. require 'class.dbmysql.php';
  4.  $db = new DbMySQLAdap('%localhost%', '%dakipl_fwc3%', '%xxxxx%', 'dakipl_fwc3');
  5. ?>


oraz zmieniłem dostep w pliku class.dbmysql.php


  1. <?php
  2. class DbMySQLAdap
  3. {
  4. var $host;
  5. var $user;
  6. var $pass;
  7. var $db_name;
  8. var $link;
  9.  
  10. // Constructor
  11. function DbMySQLAdap($host, $user, $password, $db)
  12. {
  13.  $this->host = $host; // Host address
  14.  $this->user = $user; // User
  15.  $this->pass = $password; // Password
  16.  $this->db_name = $db; // Database
  17.  
  18.  $this->connect();
  19. }
  20.  
  21. // Connect to the database
  22. function connect()
  23. {
  24.  $link = mysql_pconnect($this->xxxx, $this->xxxx, $this->xxxx) or
  25.   die ('Could not connect to the database.');
  26.  
  27.  if ($link)
  28.  {
  29.   $this->link = $link;
  30.   if (mysql_select_db($this->db_name, $link))
  31.    return true;
  32.  }
  33.  
  34.  return false;
  35. }
  36. ?>


doastem wpisałem tam gdzie sa krzyżyki może jeszce coś trzeba dodac


Baza danych wyglada tak

  1. CREATE DATABASE fwc3;
  2.  
  3. USE fwc3;
  4.  
  5. CREATE TABLE accounts (
  6. username CHAR(20) PRIMARY KEY,
  7. password CHAR(32),
  8. name CHAR(20),
  9. email CHAR(70),
  10. created DATETIME,
  11. STATUS CHAR(1)
  12. );
  13.  
  14. CREATE TABLE counters (
  15. cid CHAR(8) PRIMARY KEY,
  16. username CHAR(20),
  17. title CHAR(40),
  18. url CHAR(100),
  19. count INTEGER,
  20. style CHAR(20),
  21. minlength INTEGER
  22. );
  23.  
  24. CREATE TABLE logs (
  25. id INTEGER AUTO_INCREMENT PRIMARY KEY,
  26. cid CHAR(8),
  27. date DATETIME,
  28. ip CHAR(15),
  29. user_agent CHAR(255)
  30. );


a licznik jest na stronie http://dakipl.host4u.pl/


Z góry dziekuje za pomoc
Go to the top of the page
+Quote Post
peter13135
post 1.06.2009, 12:41:19
Post #2





Grupa: Zarejestrowani
Postów: 1 447
Pomógł: 191
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


może tabela jest pusta, lub ma złą strukturę questionmark.gif


--------------------
:)
Go to the top of the page
+Quote Post
dakipl
post 1.06.2009, 12:51:48
Post #3





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.09.2007

Ostrzeżenie: (0%)
-----


Baze wrzuciłem orginalna
Go to the top of the page
+Quote Post
muniekw
post 1.06.2009, 12:59:17
Post #4





Grupa: Zarejestrowani
Postów: 243
Pomógł: 22
Dołączył: 1.06.2009
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Cytat(dakipl @ 1.06.2009, 13:39:11 ) *
Podczas dodawania urzytkownika wystepuje błąd
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/dakipl/www/dakipl.host4u.pl/class.dbmysql.php on line 83
czyli


A możesz wkleić tą linijkę przy której pojawia się błąd? winksmiley.jpg
Go to the top of the page
+Quote Post
dakipl
post 1.06.2009, 13:10:51
Post #5





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.09.2007

Ostrzeżenie: (0%)
-----


Sorki ucze sie dobieru co mam wkleic i po czy przed czy zamienic

Bład to linijka
// Count number of rows in a result
function countRows($q)
{
$this->resCalc($q);
return (int) mysql_num_rows($q);
}
Go to the top of the page
+Quote Post
batman
post 1.06.2009, 13:11:20
Post #6





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




~dakipl proszę poprawić temat - same tagi nie są tematem oraz dodać do poprawne bbcode.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
dakipl
post 1.06.2009, 13:14:13
Post #7





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.09.2007

Ostrzeżenie: (0%)
-----


A jak zmienic nazwe tematu
Go to the top of the page
+Quote Post
peter13135
post 1.06.2009, 13:18:02
Post #8





Grupa: Zarejestrowani
Postów: 1 447
Pomógł: 191
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


Cytat(dakipl @ 1.06.2009, 14:14:13 ) *
A jak zmienic nazwe tematu


musisz go edytować (zaawansowana edycja) i tam zmień


--------------------
:)
Go to the top of the page
+Quote Post
muniekw
post 1.06.2009, 13:18:10
Post #9





Grupa: Zarejestrowani
Postów: 243
Pomógł: 22
Dołączył: 1.06.2009
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Tutaj masz odpowiedź:

http://lists.mysql.org/mysql/137597
Go to the top of the page
+Quote Post
dakipl
post 1.06.2009, 13:26:52
Post #10





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.09.2007

Ostrzeżenie: (0%)
-----


chba mam zablokowana edycje tematow sorki że żle wpisałem moge edytowac tylko posty

Ten post edytował dakipl 1.06.2009, 13:27:28
Go to the top of the page
+Quote Post
batman
post 1.06.2009, 13:35:32
Post #11





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Zmienię za Ciebie i temat i bbcode. Następnym razem pamiętaj, by od razu poprawnie napisać posta.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
dakipl
post 1.06.2009, 13:44:11
Post #12





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.09.2007

Ostrzeżenie: (0%)
-----


Dzięki

muniekw czytałem ale dalej nie kumam jak bedziesz miał troskie czasu to mógłbys mi podpowiedzieć co mam zmienic bo pisza ze przyczyna lezy kilka linijek wyżej
Go to the top of the page
+Quote Post
muniekw
post 1.06.2009, 13:47:22
Post #13





Grupa: Zarejestrowani
Postów: 243
Pomógł: 22
Dołączył: 1.06.2009
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Wywala Ci tą linikę:
  1. <?php
  2. return (int) mysql_num_rows($q);
  3. ?>


Co trzymasz w zmiennej $q. questionmark.gif

Ten post edytował muniekw 1.06.2009, 14:04:30
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 8.07.2025 - 04:47