[thelist] php/MySql Help Please

Ron Dorman rwd at csi1st.net
Tue Oct 2 22:11:58 CDT 2001


Andrew Forsberg wrote:

> >  >> in fact, die() isn't even called.
> >  >>
> >  >> no matter what i pass to die(), it doesn't happen.
>
> Do you mean that a file with nothing in it but:
>
> <?php
> die("<p>G'BYE</p>");
> ?>
>
> shows up as an empty page? That sounds like a broken php install to me.
>
> Are you experimenting in a simple page environment? It could be
> something else in a complex script that means the mysql_query()
> command isn't even getting run, let alone the die(). Can you try
> running a small script like this on your server:
>
> <?php
> mysql_connect('hostname','username','password')
>         or die("Could not connect");
> mysql_select_db("databasename")
>         or die("Could not select database");
> mysql_query("This is really not going to work as an SQL query")
>         or die(mysql_error());
> ?>
>
> You should get a page with:
> You have an error in your SQL syntax near 'This is really not going
> to work as an SQL query' at line 1

We have set up test very similar to these, just did another with the 'die'
syntax and got the sql error when the page was accessed.

This is of course not what we would want to happen when the site goes
live.  Is this a method we wuold leave in a production page?  What would be
a better way to handle development and production errors?

Ron D.





More information about the thelist mailing list