Re: trying to dump out table info
| From: | Govinda | Date: | Tue, 14 Jul 2009 00:17:10 +0000 |
| Subject: | Re: trying to dump out table info | ||
| References: | 1 2 3 4 5 6 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46297@lists.php.net to get a copy of this message | ||
On Jul 13, 2009, at 5:42 PM, Daniel Brown wrote:
On Mon, Jul 13, 2009 at 19:28, Govinda<govinda.webdnatalk@gmail.com> wrote:Dan, I am really making the effort.. despite how it may look. I read about mysql_connect again and see that 4th param is optional. seemingly intended for when we want to force a new link and not just use one that was already opened. Well I am just at this point trying to use a first link, so I would assume I need to say what db I am trying to talk to. Too bad the docs do not give a single example where the 4th param is being used. Anyway I see in the function def. that that 4th is a boolean. That does not make sense to me since I think it should be a string (the name of the database). Anyway it was working with PEAR DB with this: $db_billing=DB::connect('mysql://metheuser:mypass@localhost/billing'); and still does seem to be connecting ok with this now (without pear db)- $db_billing=mysql_connect(localhost,metheuser,mypass,billing); ...no error arises from the next line- if (!$db_billing) { die('Could not connect: ' . mysql_error()); } ...so we must be talking to the db, right? And to my real question, how can I get mysql_query what it needs in this line: $result = mysql_query($sql) or die(mysql_error()); I learn the best by *seeing* example code. I wish I could see a working example. -G$db_billing=mysql_connect(localhost,metheuser,mypass,billing); if (!$db_billing) { die('Could not connect: ' . mysql_error()); }if(!mysql_select_db('dbname',$db_billing)) die(mysql_error());The fourth parameter you have in mysql_connect() only evaluates within the engine as a boolean True statement. RTFM to see why. ;-P//$sql = "SHOW TABLES FROM billing LIKE 'mytable'"; $sql = "SHOW TABLES"; //line 237