[PHP] Parse Error on mysql_query

2005-04-16 Thread Bagus Nugroho
Hi, I'm beginning to learn PHP/MySQL, i have problem 'parse error' when using 'mysql_query' although it was simple code, like this : = 1 ?php 2 $host = localhost; 3 $user = root; 4 $pass = alpha; 5 $konek = mysql_connect($host,$user,$pass); 6 if (!$konek) { 7 die

Re: [PHP] Parse Error on mysql_query

2005-04-16 Thread Philip Hallstrom
Add a ; to the end of line 16. On Sun, 17 Apr 2005, Bagus Nugroho wrote: Hi, I'm beginning to learn PHP/MySQL, i have problem 'parse error' when using 'mysql_query' although it was simple code, like this : = 1 ?php 2 $host = localhost; 3 $user = root; 4 $pass = alpha; 5 $konek =

[PHP] Parse error in mysql_query()

2003-12-22 Thread Tyler Longren
Error: Parse error: parse error, expecting `']'' in /usr/local/apache/htdocs/UP/index.php on line 871 Line 871: mysql_query(INSERT INTO domainregistrations (domain,type,years,price) VALUES

RE: [PHP] Parse error in mysql_query()

2003-12-22 Thread Sam Masiello
Perhaps it doesn't like the fact that you don't have quotes around your array keys? --Sam Tyler Longren wrote: Error: Parse error: parse error, expecting `']'' in /usr/local/apache/htdocs/UP/index.php on line 871 Line 871: mysql_query(INSERT INTO domainregistrations

RE: [PHP] Parse error in mysql_query()

2003-12-22 Thread Tyler Longren
Sorry, should have mentioned that I tried quoting them already. That gives a T_VARIABLES parse error. Thanks for the reply, Tyler On Mon, 2003-12-22 at 12:30, Sam Masiello wrote: Perhaps it doesn't like the fact that you don't have quotes around your array keys? --Sam Tyler Longren

RE: [PHP] Parse error in mysql_query()

2003-12-22 Thread Matt Matijevich
[snip] Sorry, should have mentioned that I tried quoting them already. That gives a T_VARIABLES parse error. Thanks for the reply, Tyler [/snip] What happens if you comment out the mysql statement and just echo the variables? echo $_POST[domainregister_domain$i]

Re: [PHP] Parse error in mysql_query()

2003-12-22 Thread John W. Holmes
Tyler Longren wrote: Error: Parse error: parse error, expecting `']'' in /usr/local/apache/htdocs/UP/index.php on line 871 ('$_POST[domainregister_domain$i]', If you're going to be creating array keys like that, break out of the string to do it. (' . $_POST['domainregister_domain' . $i] . ', ...

RE: [PHP] Parse error in mysql_query()

2003-12-22 Thread Tyler Longren
Hi Matt, I put this right above like 871: print brbr$_POST[domainregister_domain$i]brbr; So now that print line is 871. It produces the exact same error as the mysql_query() line. The reason I'm doin it like this is cuz I'm dynamically generating forms, and lots of the fields are the same,

Re: [PHP] Parse error in mysql_query()

2003-12-22 Thread Tyler Longren
Doing this fixed it: mysql_query(INSERT INTO domainregistrations (domain,type,years,price) VALUES ('$_POST[domainregister_domain]$i','$_POST[domainregister_type]$i','$_POST[domainregister_years]$i','$_POST[domainregister_price]$i')); I just moved the $i to the outside of the [] and it works now.

RE: [PHP] Parse error in mysql_query()

2003-12-22 Thread Matt Matijevich
[snip] I put this right above like 871: print brbr$_POST[domainregister_domain$i]brbr; So now that print line is 871. It produces the exact same error as the mysql_query() line. [/snip] I should have mentioned this in my last email. You should try a print_r of the $_POST array. print pre;

Re: [PHP] Parse error in mysql_query()

2003-12-22 Thread John W. Holmes
Tyler Longren wrote: Hi Matt, I put this right above like 871: print brbr$_POST[domainregister_domain$i]brbr; So now that print line is 871. It produces the exact same error as the mysql_query() line. The reason I'm doin it like this is cuz I'm dynamically generating forms, and lots of the