Re: PHP/mysql equivalent of PEAR's tableInfo()??

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

 



    Top-posting.

    This would be an excellent question for Prune (CC'd) to field,
based on the error message.

    Prune?


On Sun, Jul 12, 2009 at 17:49, Govinda<govinda.webdnatalk@xxxxxxxxx> wrote:
>> On Sat, Jul 11, 2009 at 19:57, Govinda<govinda.webdnatalk@xxxxxxxxx>
>> wrote:
>>>
>>> I have been using PEAR's tableInfo() to remind myself about the columns
>>> in
>>> the table..  but now I want to see as much data as possible about the
>>> table
>>> and its contents *without* using PEAR.   (I.e. just using built in stuff
>>> for
>>> mysqli.)
>>
>>   This is not mysqli_#() directly, but just mocked up here in this
>> email.  Not guaranteed to work, but should give you the right idea at
>> least.  ;-P
>>
>> <?php
>> include('inc/config.php'); // Your configuration
>> include('inc/db.php'); // Your database connection info
>>
>> $sql = "SHOW TABLES";
>>
>> $result = mysql_query($sql);
>>
>> foreach(mysql_fetch_assoc($result) as $k => $v) {
>>       $ssql = "DESCRIBE ".mysql_real_escape_string($v);
>>       $rresult = mysql_query($ssql);
>>       echo "<b>".$k."</b>:<br />\n";
>>       echo "<pre>\n";
>>       print_r(mysql_fetch_assoc($rresult));
>>       echo "</pre>\n";
>>       echo "<br />\n";
>> }
>> ?>
>
>
> Dan I get roughly the idea, but alas I am stumped so easily in this new
> ocean..  it frustrates me.
>
> I have this code:
>
>        $db_billing=mysqli_connect(localhost,metheuser,mypass,billing);
>        if (mysqli_connect_error()) { die("Can't connect: " .
> mysqli_connect_error()); }
>        //$dbname = 'billing';
>        $sql = "SHOW TABLES";
>
>        $result = mysql_query($sql); // line 53
>
>        foreach(mysql_fetch_assoc($result) as $k => $v) {  // line 55
>        $ssql = "DESCRIBE ".mysql_real_escape_string($v);
>        $rresult = mysql_query($ssql);
>        echo "<b>".$k."</b>:<br />\n";
>        echo "<pre>\n";
>        print_r(mysql_fetch_assoc($rresult));
>        echo "</pre>\n";
>        echo "<br />\n";
>        }
>
> Which is just giving these errors:
>
> Warning: mysql_query() [function.mysql-query]: Access denied for user
> 'meee'@'localhost' (using password: NO) in
> /home/meee/public_html/somedir/test.php on line 53
>
> Warning: mysql_query() [function.mysql-query]: A link to the server could
> not be established in /home/meee/public_html/somedir/test.php on line 53
>
> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result
> resource in /home/meee/public_html/somedir/test.php  on line 55
>
> Warning: Invalid argument supplied for foreach() in
> /home/meee/public_html/somedir/test.php  on line 55
>
> --
> I am looking forward to when I have enough of my bearings that I can just
> cruise around all the various docs and figure out my own answers.   Now
> there are just so many unknowns, I often can't tell which way to even look
> to solve the issues.
> -G
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux