need help with mysql

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

The cpanel gives the following:

        PHP     $dbh=mysql_connect ("localhost", "meloniep_melonie",
        "<PASSWORD HERE>") or die('Cannot connect to the database
because: ' . mysql_error());
        mysql_select_db ("meloniep_contacts");

and this works, but when I do a 'CHECK" on the cpanel I get the

 meloniep_contacts.tab3_Relationships               OK
 meloniep_contacts.tab3_address                     OK
 meloniep_contacts.tab3_contact                     OK
 meloniep_contacts.tab3_dates                       OK
 meloniep_contacts.tab3_grouplist                   OK
 meloniep_contacts.tab3_groups                      OK
 meloniep_contacts.tab3_options                     OK
 meloniep_contacts.tab3_plugins                     OK
 meloniep_contacts.tab3_properties                  OK
 meloniep_contacts.tab3_users                       OK

I am using:

  $db_name = "meloniep_contacts";
  $dbd_name = "meloniep_melonie";

  $dbh=mysql_connect ("localhost", 'meloniep_melonie', "xxxxxxx") or
  die('Cannot connect to the database because: ' . mysql_error());

  $db_selected = mysql_select_db ($db_name);

How do I access "meloniep_contacts.tab3_address" or any of the other
table listed?

I know its right in front of me, but I am not seeing it.



Re: need help with mysql

Hash: SHA1

ChrisC wrote:
Quoted text here. Click to load it

Err well this has notgin to do with PHP.

it is more about the fact that you are missing some knowledge on how to access
and work with SQL data/tables.

so I would suggest to get some sql tutorials first.

If you have already experience with this, then I don't understand your

johannes ke▀ler
Version: GnuPG v2.0.11 (GNU/Linux)


Re: need help with mysql

You seem to have everything right.  I assume $dbd is the database user.   Once
you open a connection to the *database*,
which is meloniep_contacts, you specify the *table* by naming it inside the
query using FROM.  Choosing the table is
part of the query process, not part of the connection process.  The connection
gives you access to all the tables in the

So you would write a query like, say,
$query="SELECT * FROM tab3_address";

(I always do the query separately to keep things as spelled-out as possible.)
Then your resource would be $result;
you'll just have to study up on the PHP to get information out of the resource;
Google "mysql_fetch_array" would be a
good start.

In mysqli, which I'd recommend, you have to name the connection ($dbh) as a
parameter.  $result=mysqli_query($dbh,

Quoted text here. Click to load it

Site Timeline