NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page php/mysql help needed

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 01-04-2005, 09:12 AM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: May 2004
Location: www.dx3k.com
Posts: 581
dx3k has a spectacular aura aboutdx3k has a spectacular aura about
 



php/mysql help needed


hey

can you tell me what is wrong with this script please i keep getting "unexpected ) on line 18"


PHP Code:
<?
include('sqlinfo.php');
$connect mysql_connect($host$account$password);
$db mysql_select_db("dx3k_logger)";       <<<< this is line 18
$query 
"INSERT INTO ip VALUES (''$ip");

?>

????: NamePros.com http://www.namepros.com/programming/63178-php-mysql-help-needed.html
thanks

dx3k
__________________
I B Back
dx3k is offline  
Old 01-04-2005, 09:25 AM   #2 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
 


Breast Cancer
$db = mysql_select_db("dx3k_logger)";


should be

$db = mysql_select_db("dx3k_logger");
adam_uk is offline  
Old 01-04-2005, 09:27 AM THREAD STARTER               #3 (permalink)
NamePros Regular
Join Date: May 2004
Location: www.dx3k.com
Posts: 581
dx3k has a spectacular aura aboutdx3k has a spectacular aura about
 



still dont want to work

this is what i have now



PHP Code:
<?
$ip 
$REMOTE_ADDR;
echo 
"$ip"
?>
<?
include('sqlinfo.php');
$connect mysql_connect($host$account$password);
$db mysql_select_db("dx3k_logger");   <<< line 18
$query 
"INSERT INTO 'ip' VALUES (''$ip");

?>
__________________
I B Back
dx3k is offline  
Old 01-04-2005, 10:20 AM   #4 (permalink)
NamePros Regular
 
flexiwebhost.com's Avatar
Join Date: Jun 2004
Location: Ekenas
Posts: 271
flexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to behold
 



$query = "INSERT INTO 'ip' VALUES (''$ip");

that is wrong as well, you opened the quotes outside of the bracket but closed them in the bracket also wht do you have ''$ip

try :-

$query = "INSERT INTO 'ip' VALUES ('".$ip."')";
flexiwebhost.com is offline  
Old 01-04-2005, 02:38 PM THREAD STARTER               #5 (permalink)
NamePros Regular
Join Date: May 2004
Location: www.dx3k.com
Posts: 581
dx3k has a spectacular aura aboutdx3k has a spectacular aura about
 



now it is on about a T_STRING erro on line 18 ( i h8 this line lol) what is a t_string?




<?
include('sqlinfo.php');
$db = mysql_connect("$host", "$account");
mysql_select_db("dx3k_logger",$db);
$query = INSERT INTO `data` ( `ip` , `browser` )
VALUES (
'$ip'
);

?>



thanks

dx3k
__________________
I B Back
dx3k is offline  
Old 01-04-2005, 03:56 PM   #6 (permalink)
NamePros Regular
Join Date: Oct 2003
Location: Sweden
Posts: 395
cerebus has a spectacular aura aboutcerebus has a spectacular aura about
 


Animal Rescue Wildlife Animal Cruelty
<?
include('sqlinfo.php');
$db = mysql_connect($host,$account);
mysql_select_db("dx3k_logger",$db);
$query = "INSERT INTO `data` ( `ip` , `browser` ) VALUES ('$ip')";
?>

That should work. Just note that you have two fields defined in the fields list and only one value, in case you intend to run the query.

I must really recommend you to read a few PHP beginner tutorials.
cerebus is offline  
Old 01-05-2005, 03:16 AM THREAD STARTER               #7 (permalink)
NamePros Regular
Join Date: May 2004
Location: www.dx3k.com
Posts: 581
dx3k has a spectacular aura aboutdx3k has a spectacular aura about
 



i am already , most of the script i copyd from the book
__________________
I B Back
dx3k is offline  
Old 01-05-2005, 08:46 AM   #8 (permalink)
Senior Member
 
superprogrammer's Avatar
Join Date: Aug 2004
Location: Washington
Posts: 4,324
superprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud of
 



Originally Posted by dx3k
now it is on about a T_STRING erro on line 18 ( i h8 this line lol) what is a t_string?
????: NamePros.com http://www.namepros.com/showthread.php?t=63178




<?
include('sqlinfo.php');
$db = mysql_connect("$host", "$account");
mysql_select_db("dx3k_logger",$db);
$query = INSERT INTO `data` ( `ip` , `browser` )
VALUES (
'$ip'
);

?>



thanks

dx3k
Can you print out the line 18 here?
Thanks
__________________
Download youtube videos at www.HugYouTube.com -NO LINKS TO PARKED PAGES-
Anonymous access at www.Banned.net
superprogrammer is offline  
Old 01-05-2005, 10:58 PM   #9 (permalink)
NamePros Regular
Join Date: Oct 2003
Location: Sweden
Posts: 395
cerebus has a spectacular aura aboutcerebus has a spectacular aura about
 


Animal Rescue Wildlife Animal Cruelty
One of the following ought to be line 18 as it aint enclosed in quotes:
$query = INSERT INTO `data` ( `ip` , `browser` )
VALUES (
'$ip'
);
cerebus is offline  
Old 01-05-2005, 11:21 PM   #10 (permalink)
NamePros Regular
 
flexiwebhost.com's Avatar
Join Date: Jun 2004
Location: Ekenas
Posts: 271
flexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to beholdflexiwebhost.com is a splendid one to behold
 



you will need to enclose them in quotes, also why are you only assigning ip when your query should be inserting 2 lots of data (ip and browser)
flexiwebhost.com is offline  
Old 01-06-2005, 03:41 AM THREAD STARTER               #11 (permalink)
NamePros Regular
Join Date: May 2004
Location: www.dx3k.com
Posts: 581
dx3k has a spectacular aura aboutdx3k has a spectacular aura about
 



yer i got it to work now 100% my fault... i hadnt added myself as a user to the database i am an idiot
__________________
I B Back
dx3k is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:34 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger