note 30809 added to function.mysql-select-db

From: Date: Sun, 30 Mar 2003 04:33:39 +0000
Subject: note 30809 added to function.mysql-select-db
Groups: php.notes 
Request: Send a blank email to php-notes+get-45989@lists.php.net to get a copy of this message
here is my favorite way to do the DB thang. :) <? // db variables // inserts variables accordingly $host = ""; $user = ""; $pass = ""; $db = ""; $table = ""; // connecting to the db $link = mysql_connect ($host, $user, $pass); // the db query $q = "SELECT * from $table"; $results = mysql_db_query ($db, $q, $link); // fetching the results while ($row = mysql_fetch_array($result)){ echo "$row[whatever]<br>$row[whatever2]<br><br>"; } /* this is the area you can grab stuff from the db in the manner i did it above whatever = name of the tables colum */ // closing the db link mysql_close ($link); ?> i'd be happy to answer some questions about this topic for you newbies our there, just drop me an email. -- http://www.php.net/manual/en/function.mysql-select-db.php http://master.php.net/manage/user-notes.php?action=edit+30809 http://master.php.net/manage/user-notes.php?action=delete+30809 http://master.php.net/manage/user-notes.php?action=reject+30809

« previous php.notes (#45989) next »