Re: persistent connections/mysql (mysql examples)

From: Date: Mon, 03 Dec 2001 08:02:03 +0000
Subject: Re: persistent connections/mysql (mysql examples)
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969339416@lists.php.net to get a copy of this message
Hi, The other day I went through mysql.xml to edit out mysql_db_query then it turned into modifying every example to be somewhat similar. Wasn't sure to commit so did nothing :) Let me know if this sounds fine and don't hesitate to be picky. echoing the fetched results, not sure the best way to present that. $conn = mysql_connect($host, $user, $pass); mysql_select_db($database); $query = "SELECT user_id,fullname FROM table"; $result = mysql_query($query); if (!$result) { echo 'Query Failed: ' . mysql_error(); exit; } while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo 'User Id: ' . $row['user_id'] . "\n"; echo 'Full Name: ' . $row['fullname'] . "<br />\n"; } mysql_free_result($result); mysql_close($conn); > > 2. one more word on the examples (from the english manual): > > mysql_connect("mysql_host", "mysql_login", > > "mysql_password") > > mysql_connect ("kraemer", "marliesle", "secret") ... > > Using always the same syntax may improve understanding? Having them consistant seems good although it _may_ make a few feel this is the only way to do it. Although, not a major concern. > > I prefer the first. I used $variables, just did. 'strings' look fine too. CONSTANTS could confuse some. > > May I clean up exampels in the en-tree? I did already but don't have to. Removed mysql_db_query from "See also" too. > No, you cannot remove my girl friends :) Hmm, we need girlfriends too :) regards, Philip Olson

« previous php.doc (#969339416) next »