Phorum.ro
Your Avatar Welcome to Phorum.ro!
If you haven't registered yet, click here!
Attention Visitor:
You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Du-te înapoi   Phorum.ro > Web Design & Web Development > Programare > PHP > PHP DB

PHP DB Discutii despre lucrul cu baze de date in PHP.

Răspunde
 
Thread Tools Moduri de afișare
Vechi 12.08.2006   #1
vladutzzz
8-Bit Member
 
Data înregistrării: 12.08.2006
Mesaje: 1
Rep Power: 6
vladutzzz is on a distinguished road
Implicit MySql database error

Am shi eu o mica problema cu baza de date la mysql .
Cod PHP:
<?
$con 
mysql_connect("localhost","user","pass");
$name stripslashes($_POST['name']);
$username stripslashes($_POST['username']);
$password stripslashes(md5($_POST['password']));
$password2 stripslashes(md5($_POST['password2']));
$email stripslashes($_POST['email']);
$question stripslashes($_POST['question']);
$answer stripslashes($_POST['answer']);
if (!
$con)
   {
   die(
'Could not connect: ' mysql_error());
   }
   else if (
$password != $password2) {
   echo 
"SORRY , PASSWORDS DON'T MATCH";
   }
   @
mysql_select_db("db");
  
$sql="INSERT INTO table (name,username,password,email,question,answer) VALUES 

('$name','$username','$password','$email','$question','$answer')"
;
  
   if (!
mysql_query($sql,$con));
  {
  die(
'Error: ' mysql_error());
  }
   echo 
"YOUR ACCOUNT HAS BEEN CREATED";
   
mysql_close($con);
?>
Cand ma duc sa ma registrez imi arata : Error : No databse selected Care este problema ???
vladutzzz is offline   Reply With Quote
Sponsored Links
Vechi 13.08.2006   #2
indy2kro
32-Bit Member
 
indy2kro's Avatar
 
Data înregistrării: 26.02.2006
Locație: Bucuresti
Vârsta: 27
Mesaje: 173
Rep Power: 7
indy2kro is on a distinguished road
Trimite un mesaj prin Yahoo pentru indy2kro
Implicit

Pai.. chiar asta e problema, nu ai selectat nici o baza de date ... foloseste si tu functia mysql_select_db() dupa mysql_connect().

Atunci cand apelezi mysql_connect() nu faci altceva decat sa deschizi o conexiune catre MySQL - care poate avea mai multe baze de date (iar tu poti avea acces la una sau mai multe din ele), MySQL nu are de unde sa stie pe care baza de date vrei tu sa rulezi query-ul respectiv.
indy2kro is offline   Reply With Quote
Vechi 13.08.2006   #3
Achiles
32-Bit Member
 
Achiles's Avatar
 
Data înregistrării: 23.03.2006
Locație: somewhere
Vârsta: 22
Mesaje: 53
Rep Power: 7
Achiles is on a distinguished road
Trimite un mesaj prin Yahoo pentru Achiles
Implicit

Eu vad ca are asa ceva
Citat:
În prealabil postat de vladutzzz
Cod PHP:
   @mysql_select_db("db"); 
Achiles is offline   Reply With Quote
Vechi 13.08.2006   #4
outkast
64-Bit member
 
outkast's Avatar
 
Data înregistrării: 06.02.2006
Locație: Romania
Vârsta: 27
Mesaje: 227
Rep Power: 7
outkast is on a distinguished road
Implicit

scoate @ din fata de la mysql_select_db(), pune la inceputul scriptului
Cod PHP:
error_reporting(E_ALL); 
si ruleaza scriptul, vezi daca apare vreo eroare noua. si posteaza ce apare (daca apare)

le: care e faza cu <?php BEGIN__VBULLETIN__CODE__SNIPPET, la voi apare?
__________________
A good Manager will take you through the forest, no mater what. A Leader will take time to climb on a tree and say 'This is the wrong forest'

blog.florindinu.ro - Another boring blog

Last edited by outkast; 13.08.2006 at 18:52:19.
outkast is offline   Reply With Quote
Răspunde


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Moduri de afișare

Reguli de postare
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Pornit
emoticoanele sunt Pornit
Codul [IMG] este Pornit
Codul HTML este Oprit



Ora este GMT +3. Ora este acum 01:44:04.


Rulează cu: vBulletin Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum SEO by Zoints

XXXXXXXXXXXXXXXXXXX
Inactive Reminders By Icora Web Design