Re: trying to dump out table info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jul 13, 2009, at 5:42 PM, Daniel Brown wrote:

On Mon, Jul 13, 2009 at 19:28, Govinda<govinda.webdnatalk@xxxxxxxxx> wrote:

       $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());

       //$sql = "SHOW TABLES FROM billing LIKE 'mytable'";
       $sql = "SHOW TABLES"; //line 237

   The fourth parameter you have in mysql_connect() only evaluates
within the engine as a boolean True statement.  RTFM to see why.  ;-P

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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux