[php/sql] Error msg

Pagina: 1
Acties:
  • 146 views sinds 30-01-2008
  • Reageer

Onderwerpen


  • Speedener
  • Registratie: September 2000
  • Laatst online: 12-09 15:51
Ik heb nu op mijn site bovenaan een mysql verbinding.

code:
1
2
 $mysql_connection = mysql_connect("$dbhost","$dbuser","$dbpassword");
 mysql_select_db ("$dbname") or die ("DB FOUT!");


Als de db server down is krijg ik netjes DB FOUT in beeld, maar daarboven komen een stuk of 5 warning msg zoals
Warning: Unknown MySQL Server Host 'localhosts' (0) in c:\program files

Warning: MySQL Connection Failed: Unknown MySQL Server Host 'localhosts' (0) in c:\program files\

Warning: Access denied for user: 'ODBC@localhost' (Using password: NO) in c:\program files

Warning: MySQL Connection Failed: Access denied for user: 'ODBC@localhost' (Using password: NO) in c:\program files\

Warning: MySQL: A link to the server could not be established in c:\program files\easyphp\
Er er een mannier om die error msg niet te laten zien maar alleen DB FOUT?

LG Therma V Split WP: HU143MA.U33-HN1636M NK5


  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 12-09 14:38

Basszje

Reisvaap!]

Die errors zitten toch in mysql_connect :? Dan kan je die toch gewoon 'or die' doen :?

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • Speedener
  • Registratie: September 2000
  • Laatst online: 12-09 15:51
Ja ok, ik heb er nu dus
$mysql_connection = mysql_connect("$dbhost","$dbuser","$dbpassword") or die ("FOUT!");

van gemaakt, dan hou ik nog 2 error berichten over die ik niet wil.


Warning: Unknown MySQL Server Host 'localhosts' (0) in c:\program files\easyphp\

Warning: MySQL Connection Failed: Unknown MySQL Server Host 'localhosts' (0) in c:\program files\
FOUT!

LG Therma V Split WP: HU143MA.U33-HN1636M NK5


  • wustenveld
  • Registratie: Februari 2002
  • Laatst online: 07-07 13:36
Bestaat de host 'localhosts' wel?? Moet het niet bijvoorbeeld 'localhost' (zonder s) of '127.0.0.1' zijn. Zelf gebruik ik altijd het echte ip nummer van de webserver (bijvoorbeeld 192.168.0.25).

  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 12-09 14:38

Basszje

Reisvaap!]

wustenveld schreef op 11 september 2002 @ 13:29:
Bestaat de host 'localhosts' wel?? Moet het niet bijvoorbeeld 'localhost' (zonder s) of '127.0.0.1' zijn. Zelf gebruik ik altijd het echte ip nummer van de webserver (bijvoorbeeld 192.168.0.25).
Het idee is hier meer denk ik om dat juist af te vangen als het mis gaat ;) .

Kan het zijn dat or die niet stopt op warnings :? .
Anders op de productie in de php.ini de errors en warnings uitzetten wellicht :? ( als dat kan )

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • RedHat
  • Registratie: Augustus 2000
  • Laatst online: 09-09 17:16
localhosts != localhost

PHP zegt gewooon netjes dat MySQL niet aanstaat, want hij kan niet connecten, dus bij de rest van de akties geeft ie natuurlijk ook een error msg, omdat er geen connectie bestaat.

HINT: Zet mysql aan op localhost of zoiets.

Verwijderd

zet voor de php opdrachten een @ voor...

dus bv: @mysql_connect(...) ipv mysql_connect

  • David
  • Registratie: Februari 2001
  • Laatst online: 20:40
Verwijderd schreef op 11 september 2002 @ 13:35:
zet voor de php opdrachten een @ voor...

dus bv: @mysql_connect(...) ipv mysql_connect
Da's niet echt het probleem oplossen. Het beste kun je echt kijken wat er aan de hand is en dat oplossen. Fouten verbergen is niet de manier.

Dato DUO synth voor twee


  • MichelVH
  • Registratie: Oktober 2001
  • Laatst online: 11-09 21:04
De topicstarter heeft ook geen probleem... :+ Hij wil juist áls hij wel een keer een probleem heeft omdat het databeest op z'n plaat gaat, een nette foutmelding weergeven en niet allerlei warnings. En dan is de oplossing van Fung inderdaad de juiste :)

Don't be afraid of the dark, be afraid of what it hides


Verwijderd

Neen, dat is juist vet RANZIG! Gebruik liever trigger_error in combinatie met error_reporting. Check http://www.php.net/manual/en/ref.errorfunc.php voor meer info.

  • MichelVH
  • Registratie: Oktober 2001
  • Laatst online: 11-09 21:04
Hmmm... weer wat geleerd :) Ik dacht dat dat niet werkte voor warnings 8)7

Don't be afraid of the dark, be afraid of what it hides


  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06 13:31

drm

f0pc0dert

daniel_hoenderdos:
Neen, dat is juist vet RANZIG! Gebruik liever trigger_error in combinatie met error_reporting. Check http://www.php.net/manual/en/ref.errorfunc.php voor meer info.
:* ;)

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz

Pagina: 1