mysql_connect($server, $db_user, $db_pass)
06-28-2008, 12:25 PM
|
mysql_connect($server, $db_user, $db_pass)
|
Posts: 680
Name: Lashtal
|
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
|
|
|
|
06-28-2008, 01:42 PM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
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
.
|
|
|
|
06-28-2008, 03:28 PM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 321
|
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
|
|
|
|
06-28-2008, 06:37 PM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 30
|
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
|
|
|
|
06-30-2008, 06:45 AM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 680
Name: Lashtal
|
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
|
|
|
|
06-30-2008, 02:45 PM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
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
.
|
|
|
|
07-01-2008, 12:13 AM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 680
Name: Lashtal
|
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
|
|
|
|
07-01-2008, 11:47 AM
|
Re: mysql_connect($server, $db_user, $db_pass)
|
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
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
.
|
|
|
|
|
« Reply to mysql_connect($server, $db_user, $db_pass)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|