p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Can you explain this statement in English?


Message #1 by "Art Stoller" <phphelp@w...> on Sun, 6 Oct 2002 12:04:59
Can you say this statement in English?

if (!mysql_create_db ( ?dummy_db? , $link_id ))  die (sql_error( )) ;

Would the following be correct?
Create a database called ?dummy? with a connection $link_id
If its not created, then die.

Message #2 by "Lawrence" <spam@k...> on Sun, 6 Oct 2002 17:56:56 -0400
> Can you say this statement in English?
> 
> if (!mysql_create_db ( "dummy_db" , $link_id ))  die (sql_error( )) ;
> 
> Would the following be correct?
> Create a database called "dummy" with a connection $link_id
> If its not created, then die.

Almost. You're not creating a database called dummy with a connection $link_id,
you're creating a database called dummy and the $link_id is there so PHP knows 
which server you're trying to talk to. 




Message #3 by "David Scott-Bigsby" <DScott-Bigsby@P...> on Mon, 7 Oct 2002 21:40:01 -0700
> > Can you say this statement in English?
> >
> > if (!mysql_create_db ( "dummy_db" , $link_id ))  die
> (sql_error( )) ;
> >
> > Would the following be correct?
> > Create a database called "dummy" with a connection $link_id
> > If its not created, then die.
>
> Almost. You're not creating a database called dummy with a
> connection $link_id,
> you're creating a database called dummy and the $link_id is
> there so PHP knows
> which server you're trying to talk to.

And if mysql_create_db() fails to create dummy_db, the script outputs 
the error message from the database before it dies.

However, there's an error in the code.

If a mysql_* function has an error, mysql_error() -- not sql_error() -- 
will give you the error message.

dsb

***************************************       
David Scott-Bigsby
Product Manager, Web Site and PEDN

PureEdge Solutions
The Leader in Secure XML e-Forms

v:250-708-8145  f:250-708-8010
1-888-517-2675   www.PureEdge.com
***************************************


> -----Original Message-----
> From: Lawrence [mailto:spam@k...]
> Sent: Sunday, October 06, 2002 2:57 PM
> To: beginning php
> Subject: [beginning_php] Re: Can you explain this statement
> in English?
>
>
>
>
>
>
>
>
>

  Return to Index