/    Sign up×
Community /Pin to ProfileBookmark

When I connect to a Database, I use this format:

[code=php]$db = mysqli_connect(‘localhost’,’root’,’password’) or die(‘Problem connecting’ . mysqli_error());[/code]

I haven’t seen the results of mysqli_error(). Is there a way, for testing and debugging to get actual “feedback” of the errors?

I used to get it in my much PHP days, before MySQL. blah blah blah on line 23. It used to shot up in the browser. So at least I could “isolate” the problem. Now days I only get a blank page and have to comment out potential trouble spots.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@criterion9Dec 09.2009 — Do you have error_reporting turned off in php.ini? Try setting to E_ALL.

http://us.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
Copy linkTweet thisAlerts:
@MindzaiDec 09.2009 — I think you want mysqli_connect_error.
Copy linkTweet thisAlerts:
@Hooded_VillianauthorDec 09.2009 — Do you have error_reporting turned off in php.ini? Try setting to E_ALL.

http://us.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting[/QUOTE]


[code=php]
; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
[/code]


Oh wait... For it to be on, I have to remove the semi colon, innit?
Copy linkTweet thisAlerts:
@Hooded_VillianauthorDec 09.2009 — I think you want mysqli_connect_error.[/QUOTE]

Will try it out... Done. It's in. Lets see how it goes.

PS: I am currently looking for error reporting in PHP

eg:[undefined variable] blah blah line 32

It still runs the entire page, just prints out the errors. It currently seems that it halts on any and all errors.
Copy linkTweet thisAlerts:
@MindzaiDec 10.2009 — Whether the script will die or not depends on the error level. Notices and warnings will not stop processing.
Copy linkTweet thisAlerts:
@Hooded_VillianauthorFeb 28.2010 — [code=php]
; display_errors
; Default Value: On
; Development Value: On
; Production Value: Off

; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off

; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED[/code]


This is my php.ini file settings and I still cant get the errors to display on the page being loaded... Instead the whole page halts.
×

Success!

Help @Hooded_Villian spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...