Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
mysql_connect($server, $db_user, $db_pass)
Old 06-28-2008, 12:25 PM mysql_connect($server, $db_user, $db_pass)
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
PHP Code:
<?php  
if($_GET['ref']) 
{  
  if(
$cookieExpiration != 0)
    
$cookieLifetime time() + $cookieExpiration*86400;
  else
    
$cookieLifetime =  time() + 3650*86400;
    
  
SetCookie ("ref",$_GET['ref'], $cookieLifetime$cookiePath$cookieDomain);
  
SetCookie ("ref",$_GET['ref'], $cookieLifetime$cookiePath$cookieDomain);
  
SetCookie ("ref",$_GET['ref'], $cookieLifetime$cookiePath$cookieDomain);
  
SetCookie ("ref",$_GET['ref'], $cookieLifetime$cookiePath$cookieDomain);
  
SetCookie ("ref",$_GET['ref'], $cookieLifetime$cookiePath$cookieDomain);
  
session_start();
  
$_SESSION['ref'] = $_GET['ref'];
  include 
"affconfig.php";   
  
mysql_connect($server$db_user$db_pass
    or die (
"Database CONNECT Error (line 17)"); 
    
  
mysql_db_query($database"INSERT INTO clickthroughs VALUES ('".$_GET['ref']."', '$clientdate', '$clienttime', '$clientbrowser', '$clientip', '$clienturl', '')"); 
}
?>
I keep getting a "Parse error" on line 21

line 21 would be the section that reads: mysql_connect($server, $db_user, $db_pass)


My question is this...

When entering my server address, username and password, Do I do it like this:

a) mysql_connect($ServerAddressHere, $MyUserName, $MyPassword)

or do I do it like this...

b) mysql_connect(ServerAddressHere, MyUserName, MyPassword) ?

Help appreciated mucho gracias
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-28-2008, 01:42 PM Re: mysql_connect($server, $db_user, $db_pass)
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
What you have looks correct to me. Be sure that you are inputing valid data into the mysql_connect() function.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 06-28-2008, 03:28 PM Re: mysql_connect($server, $db_user, $db_pass)
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
If you are define your server, username and pass in some outside php file then look inside this file and see are you type some feller. You didn't post full warnings, but it's looking like something bad in code. For example:
$server = "localhost;"
And, of course, in that case you must use $server, $username, $pass.

Shivaji
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 06-28-2008, 06:37 PM Re: mysql_connect($server, $db_user, $db_pass)
webmaster4hire's Avatar
Experienced Talker

Posts: 30
Trades: 0
Hi,

You need to do something like:

$server = 'yourservername';
$db_user = 'yourdbusername';
$db_pass = 'yourdbpassword';

maybe these settings are in the included file "affconfig.php" so check there before.

good luck,
dylan
webmaster4hire is offline
Reply With Quote
View Public Profile
 
Old 06-30-2008, 06:45 AM Re: mysql_connect($server, $db_user, $db_pass)
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
So...

am I, or am I not supposed to include the dollar signs "$" when entering my info to mysql_connect($server, $db_user, $db_pass) ?

The server i'm sending this script to does not equal "Localhost"
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
Old 06-30-2008, 02:45 PM Re: mysql_connect($server, $db_user, $db_pass)
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Unless you want the server, user and password parameters to be interpreted as either a string or a constant, you must include the "$" before the parameters, which means you are inputting a variable. Of course, this doesn't mean much if you aren't supplying a value to the variable beforehand.

All the mysql_connect function is asking for is three strings. It doesn't matter how they are inputted.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-01-2008, 12:13 AM Re: mysql_connect($server, $db_user, $db_pass)
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
Just figured it out.

This script was intended to call information from ANOTHER script altogether. It was getting the information from the dollar sign, and I wasn't supposed to put anything into it, as it was being called by another script complimentary to this one.

I'm new at PHP, and i'm learning from scratch. So if I sound a little stupid, this is why

Thanks for your help.
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
Old 07-01-2008, 11:47 AM Re: mysql_connect($server, $db_user, $db_pass)
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
It's okay, everyone starts somewhere. Good luck, and keep learning!
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to mysql_connect($server, $db_user, $db_pass)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27029 seconds with 12 queries