Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

mysql_connect('localhost', 'user-name', 'password');


custodian

Recommended Posts

Posted

OK, this is a php/mysql dev question

 

I'm currently working on a new contribution and while I have some minimal php under my belt, I have zero when it comes to php with mysql and while I've been looking through the OC files I haven't been able to find what I'm looking for.

 

Basically stated.. I want to replace this part which I used tfor testing

 

 

require('includes/application_top.php');

$db = mysql_connect('localhost', 'user-name', 'password');

mysql_select_db('memorylane',$db);

$result = mysql_query('SELECT * FROM customers',$db);

printf("Field Entry: %s<br>\n", mysql_result($result,1,'customers_custom_field'));

 

It works, but I'm not sure how to eliminate the

$db = mysql_connect('localhost', 'user-name', 'password');

and replace the "1" with the variable that is assigned to the current logged in customer

 

So that when the printf runs for login use Bob, the "1" is his db ID.

 

I've been looking through oscommerce forum, dev, google and more but can't find anythign that references all the OC variables and such in any detail.

 

Any help is appreciated.

My Contributions

 

Henry Smith

Posted

What you do is replace

 

$db = mysql_connect('localhost', 'user-name', 'password');

 

with

 

include('includes/configure.php');

 

That should eliminate

 

$db = mysql_connect('localhost', 'user-name', 'password');

mysql_select_db('memorylane',$db);

 

Hope this helps

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Posted

Connecting perfectly.

 

Thank you!

 

Now I need to look into the correct user variable

 

 

 

What you do is replace

 

$db = mysql_connect('localhost', 'user-name', 'password');

 

with

 

include('includes/configure.php');

 

That should eliminate

 

$db = mysql_connect('localhost', 'user-name', 'password');

mysql_select_db('memorylane',$db);

 

Hope this helps

My Contributions

 

Henry Smith

Posted

N/P anytime, can't help you with the other though. Not that PHP smart yet...:)

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...