Frank100 Posted June 25, 2007 Share Posted June 25, 2007 Question, is the connection done with the following $cxn already ? Or is this just defining a variable which will be executed later in the $result ? If just a variable definition, how would I execute $ result ? $cxn = mysqli_connect($host,$user,$password,$database) or die ("Couldn't connect to server"); $result = mysqli_query($cxn,$query) or die ("Couldn't execute insert query"); Regards, Frank Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 25, 2007 Share Posted June 25, 2007 Yes, that will connect you =] It doesn't matter if it is in a variable or not. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted June 25, 2007 Share Posted June 25, 2007 What would saving it to a variable do? Just tell you whether or not is executed without any errors? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 25, 2007 Share Posted June 25, 2007 Variables are not executed - they are 'used'. In php the mysql(i)_connect is a construct that creates a resource. This resource is used in subsequent interactions with the database. Quote Link to comment Share on other sites More sharing options...
Frank100 Posted June 25, 2007 Author Share Posted June 25, 2007 thx for the replies, so when I understand right in the following sample $qry is not creating a variable because it creates a resource that immediately is executed ? <?php $qry =mysql_query("SELECT * FROM `staff` WHERE `clue` > 0"); echo mysql_num_rows($qry); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.