Re: [PHP] Parse Error(newbie)

2002-05-29 Thread 1LT John W. Holmes

Look for errors in the line above this one. PHP doesn't know what SQL is...it's just a 
string to PHP.

---John Holmes...
  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, May 29, 2002 9:03 AM
  Subject: [PHP] Parse Error(newbie)


  I get a parse error on this line

  $query = SELECT * FROM news ORDER BY id DESC LIMIT 1;

  I believe that it is an error in the SQL statement

  Thanks in advance

  JJ Harrison
  [EMAIL PROTECTED]
  www.tececo.com


--


  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Parse Error(newbie)

2002-05-29 Thread Stuart Dallas

[EMAIL PROTECTED] wrote:
 $query = SELECT * FROM news ORDER BY id DESC LIMIT 1;

 I believe that it is an error in the SQL statement

Nope, looks fine. Show us the previous few lines, the error is probably in
those somewhere.

--
Stuart


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then [EMAIL PROTECTED] declared
 I get a parse error on this line
 
 $query = SELECT * FROM news ORDER BY id DESC LIMIT 1;
 
 I believe that it is an error in the SQL statement

Nothing wrong with that. Let's have the whole error msg and the code
surrouding the line it says it's on please It might well not be on
that line at all.
- -- 
Nick Wilson // www.tioka.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE89NLaHpvrrTa6L5oRAiZ0AJ9fXPhupt203ghx8nNnDkgrtkgpsgCfQRFO
tpYkUeHN5k9+EZxGuZbP34k=
=QCuq
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread webmaster

Here is the function:

function print_new_story(){
$query = SELECT * FROM news ORDER BY id DESC LIMIT 1;
$result = mysql_query($query);
$num_results = mysql_num_rows($result);

for ($i=0; $i  $num_results; $i++)
  {
 $row = mysql_fetch_array($result);
 echo 'h2a href=#: ';
 echo $row['title'];
 if(!$row['date'] == 0){
 echo ' - ';
 echo date(d-M-y, $row['date']);
 }
 echo ' :/a/h2br';
include $row['int_location'];
  }

}

and here is the error message:
Parse error: parse error in \\johnh\c\co2 busters\includes\functions.php on
line 81
- Original Message -
From: Nick Wilson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 11:08 PM
Subject: Re: [PHP] Parse Error(newbie)


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1


 * and then [EMAIL PROTECTED] declared
  I get a parse error on this line
 
  $query = SELECT * FROM news ORDER BY id DESC LIMIT 1;
 
  I believe that it is an error in the SQL statement

 Nothing wrong with that. Let's have the whole error msg and the code
 surrouding the line it says it's on please It might well not be on
 that line at all.
 - --
 Nick Wilson // www.tioka.com



 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.0.6 (GNU/Linux)

 iD8DBQE89NLaHpvrrTa6L5oRAiZ0AJ9fXPhupt203ghx8nNnDkgrtkgpsgCfQRFO
 tpYkUeHN5k9+EZxGuZbP34k=
 =QCuq
 -END PGP SIGNATURE-

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread Jason Wong

On Wednesday 29 May 2002 21:13, [EMAIL PROTECTED] wrote:
 Here is the function:

 function print_new_story(){
 $query = SELECT * FROM news ORDER BY id DESC LIMIT 1;
 $result = mysql_query($query);
 $num_results = mysql_num_rows($result);

 for ($i=0; $i  $num_results; $i++)
   {
  $row = mysql_fetch_array($result);
  echo 'h2a href=#: ';
  echo $row['title'];
  if(!$row['date'] == 0){
  echo ' - ';
  echo date(d-M-y, $row['date']);
  }
  echo ' :/a/h2br';
 include $row['int_location'];
   }

 }

 and here is the error message:
 Parse error: parse error in \\johnh\c\co2 busters\includes\functions.php on
 line 81

We're not mind readers, which is line 81?

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Would it help if I got out and pushed?
-- Princess Leia Organa
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread webmaster

Line 81 is $query.

I showed it in my first email.

I suspect this line is the one causing the trouble(It is about four lines
above the start of the function and is the only previous PHP statement)
mysql_query(delete from conf_event where time  ( time() );

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 11:11 PM
Subject: Re: [PHP] Parse Error(newbie)


 On Wednesday 29 May 2002 21:13, [EMAIL PROTECTED] wrote:
  Here is the function:
 
  function print_new_story(){
  $query = SELECT * FROM news ORDER BY id DESC LIMIT 1;
  $result = mysql_query($query);
  $num_results = mysql_num_rows($result);
 
  for ($i=0; $i  $num_results; $i++)
{
   $row = mysql_fetch_array($result);
   echo 'h2a href=#: ';
   echo $row['title'];
   if(!$row['date'] == 0){
   echo ' - ';
   echo date(d-M-y, $row['date']);
   }
   echo ' :/a/h2br';
  include $row['int_location'];
}
 
  }
 
  and here is the error message:
  Parse error: parse error in \\johnh\c\co2 busters\includes\functions.php
on
  line 81

 We're not mind readers, which is line 81?

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 Would it help if I got out and pushed?
 -- Princess Leia Organa
 */


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Parse Error(newbie)

2002-05-29 Thread Niklas Lampén

mysql_query(delete from conf_event where time  ( time() );

You're missing the ending  there.


Niklas

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 29. toukokuuta 2002 16:20
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Parse Error(newbie)


Line 81 is $query.

I showed it in my first email.

I suspect this line is the one causing the trouble(It is about four
lines above the start of the function and is the only previous PHP
statement) mysql_query(delete from conf_event where time  ( time() );

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 11:11 PM
Subject: Re: [PHP] Parse Error(newbie)


 On Wednesday 29 May 2002 21:13, [EMAIL PROTECTED] wrote:
  Here is the function:
 
  function print_new_story(){
  $query = SELECT * FROM news ORDER BY id DESC LIMIT 1; $result = 
  mysql_query($query); $num_results = mysql_num_rows($result);
 
  for ($i=0; $i  $num_results; $i++)
{
   $row = mysql_fetch_array($result);
   echo 'h2a href=#: ';
   echo $row['title'];
   if(!$row['date'] == 0){
   echo ' - ';
   echo date(d-M-y, $row['date']);
   }
   echo ' :/a/h2br';
  include $row['int_location'];
}
 
  }
 
  and here is the error message:
  Parse error: parse error in \\johnh\c\co2 
  busters\includes\functions.php
on
  line 81

 We're not mind readers, which is line 81?

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development 
 *

 /*
 Would it help if I got out and pushed?
 -- Princess Leia Organa
 */


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread Jason Wong

On Wednesday 29 May 2002 21:22, Niklas Lampén wrote:
 mysql_query(delete from conf_event where time  ( time() );

 You're missing the ending  there.


 Niklas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 29. toukokuuta 2002 16:20
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Parse Error(newbie)


 Line 81 is $query.

 I showed it in my first email.

 I suspect this line is the one causing the trouble(It is about four
 lines above the start of the function and is the only previous PHP
 statement) mysql_query(delete from conf_event where time  ( time() );

It is cases like these where an editor with /decent/ syntax highlighting is 
invaluable. 

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
A man is like a rusty wheel on a rusty cart,
He sings his song as he rattles along and then he falls apart.
-- Richard Thompson
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread webmaster

Notepad at the moment as I can't change the settings of my computer due to
lack of privilages
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 11:26 PM
Subject: Re: [PHP] Parse Error(newbie)


 On Wednesday 29 May 2002 21:22, Niklas Lampén wrote:
  mysql_query(delete from conf_event where time  ( time() );
 
  You're missing the ending  there.
 
 
  Niklas
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: 29. toukokuuta 2002 16:20
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Parse Error(newbie)
 
 
  Line 81 is $query.
 
  I showed it in my first email.
 
  I suspect this line is the one causing the trouble(It is about four
  lines above the start of the function and is the only previous PHP
  statement) mysql_query(delete from conf_event where time  ( time() );

 It is cases like these where an editor with /decent/ syntax highlighting
is
 invaluable.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 A man is like a rusty wheel on a rusty cart,
 He sings his song as he rattles along and then he falls apart.
 -- Richard Thompson
 */


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(newbie)

2002-05-29 Thread Jason Wong

On Wednesday 29 May 2002 21:45, [EMAIL PROTECTED] wrote:
 Notepad at the moment as I can't change the settings of my computer due to
 lack of privilages

You have my sympathy :)
-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Take heart amid the deepening gloom that your dog is finally getting
enough cheese.
-- National Lampoon, Deteriorata
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(Newbie)

2002-05-27 Thread Miguel Cruz

On Mon, 27 May 2002 [EMAIL PROTECTED] wrote:
 I know it is probably something obvious but the following gives me a
 parse error and as a newbie I am having trouble locating it.
 
 $query = select * from news WHERE id = $_get['id'];

A lot of people have answered this already, but just for a little more 
clarification, consider this: 

The reason the computer requires you to surround a string with quotes is 
so that it knows where the string begins and ends.

If you put quotes in the middle of the string, it thinks those mark the 
end; why would it think otherwise, since that's what quotes are for.

So people have provided you with various solutions for this. Each of them 
involve in some way indicating more specifically what's going on. Either 
you use a different kind of quotes (if you started the string with single 
quotes, it will let you put double quotes inside it without getting 
confused, and vice versa), or you use the backslash character before 
internal quotes. Backslash is the escape character which in this case 
tells the parser to ignore the special meaning of the quote that follows. 
So your line could have been written in any of the following ways:

  $query = select * from news WHERE id = '{$_get['id']}';
  $query = select * from news WHERE id = \{$_get['id']}\;
  $query = 'select * from news WHERE id = ' . $_get['id'] . '';

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Parse Error(Newbie)

2002-05-27 Thread John Holmes

Also note that variables are case sensitive in PHP. So $_get and $_GET
are not the same. If you're using the new super-global variables on
PHP, then you need to use $_GET['id']...

---John Holmes...

 -Original Message-
 From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 27, 2002 2:18 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Parse Error(Newbie)
 
 On Mon, 27 May 2002 [EMAIL PROTECTED] wrote:
  I know it is probably something obvious but the following gives me a
  parse error and as a newbie I am having trouble locating it.
 
  $query = select * from news WHERE id = $_get['id'];
 
 A lot of people have answered this already, but just for a little more
 clarification, consider this:
 
 The reason the computer requires you to surround a string with quotes
is
 so that it knows where the string begins and ends.
 
 If you put quotes in the middle of the string, it thinks those mark
the
 end; why would it think otherwise, since that's what quotes are for.
 
 So people have provided you with various solutions for this. Each of
them
 involve in some way indicating more specifically what's going on.
Either
 you use a different kind of quotes (if you started the string with
single
 quotes, it will let you put double quotes inside it without getting
 confused, and vice versa), or you use the backslash character before
 internal quotes. Backslash is the escape character which in this
case
 tells the parser to ignore the special meaning of the quote that
follows.
 So your line could have been written in any of the following ways:
 
   $query = select * from news WHERE id = '{$_get['id']}';
   $query = select * from news WHERE id = \{$_get['id']}\;
   $query = 'select * from news WHERE id = ' . $_get['id'] . '';
 
 miguel
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(Newbie)

2002-05-27 Thread Matt Giddings


try this:

$query = select * from news WHERE id = '$_get['id']';

the double quote right before the $ is ending the string, from that point 
on everything is an error.

Matt

On Mon, 27 May 2002 [EMAIL PROTECTED] wrote:

 I know it is probably something obvious but the following gives me a parse error and 
as a newbie I am having trouble locating it.
 
 $query = select * from news WHERE id = $_get['id'];
 
 JJ Harrison
 [EMAIL PROTECTED]
 www.tececo.com
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(Newbie)

2002-05-27 Thread Matt Giddings


Another thing you may want to try is the following line:

$query = select * from news WHERE id = ' . $_get['id'] . ';

Matt

On Mon, 27 May 2002 [EMAIL PROTECTED] wrote:

 I know it is probably something obvious but the following gives me a parse error and 
as a newbie I am having trouble locating it.
 
 $query = select * from news WHERE id = $_get['id'];
 
 JJ Harrison
 [EMAIL PROTECTED]
 www.tececo.com
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Parse Error(Newbie)

2002-05-26 Thread Martin Towell

$query = select * from news WHERE id = $_get['id'];
 
you've got quotes within quotes - either change the inner quotes to single
quotes, or escape them
 
$query = select * from news WHERE id = '$_get[id]';
or
$query = select * from news WHERE id = \$_get['id']\;
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 27, 2002 3:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Parse Error(Newbie)


I know it is probably something obvious but the following gives me a parse
error and as a newbie I am having trouble locating it.
 
$query = select * from news WHERE id = $_get['id'];
 
JJ Harrison
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
www.tececo.com http://www.tececo.com 



RE: [PHP] Parse Error(Newbie)

2002-05-26 Thread Peter

can you show us the lines above that line? say the previous 2 lines?.. also
depending on what server your on you might want to try

$query = SELECT * FROM news WHERE id = $_get['id'];

but that line is ok ... with parse errors it's often, well i've found this
any way, that it's the line above the line the message says it is..
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Monday, 27 May 2002 3:47 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Parse Error(Newbie)


  I know it is probably something obvious but the following gives me a parse
error and as a newbie I am having trouble locating it.

  $query = select * from news WHERE id = $_get['id'];

  JJ Harrison
  [EMAIL PROTECTED]
  www.tececo.com



RE: [PHP] Parse Error(Newbie)

2002-05-26 Thread David Freeman


-Original Message-
I know it is probably something obvious but the following gives me a
parse error and as a newbie I am having trouble locating it.

$query = select * from news WHERE id = $_get['id'];
-Original Message-

Any time you end up with two  characters together is a pretty good
indication of where you problem is.

You might try this:

$query = SELECT * FROM news WHERE ID = ' . $_get['id'] . ';

Alternately, and depending on what you're doing and why, it might be
more effective to do this:

$idstring = $_get['id'];
$query = SELECT * FROM news WHERE ID = '$idstring';

Your choice...

CYA, Dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(Newbie)

2002-05-23 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then [EMAIL PROTECTED] declared
 I get a parse error on line 114 can anyone see the problem?
 
 Sorry if it is something obvious :}
 for ($i=0; $i $num_results; $i++)
 
 110. {
 
 111. $row = mysql_fetch_array($result);
 
 112. echo 'a href=';
 
 113. echo $row['url'];
 
 114. echo '';


Have you tried escaping the double quotes?
echo '\';
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE87NI7HpvrrTa6L5oRAox5AJwJ5alFlqn0VtSTdLWKiQNVoKvZtQCgsEhj
Umv5vrmmT8J0dDGSehyv5CU=
=LknC
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Parse Error(Newbie)

2002-05-23 Thread Brian McGarvie

why now just write:

for ($i=0; $i $num_results; $i++) {
  $row = mysql_fetch_array($result);
  echo a href=\.$row['url'].\link text/a;


 -Original Message-
 From: Nick Wilson [mailto:[EMAIL PROTECTED]]
 Sent: 23 May 2002 12:28 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Parse Error(Newbie)
 
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 
 * and then [EMAIL PROTECTED] declared
  I get a parse error on line 114 can anyone see the problem?
  
  Sorry if it is something obvious :}
  for ($i=0; $i $num_results; $i++)
  
  110. {
  
  111. $row = mysql_fetch_array($result);
  
  112. echo 'a href=';
  
  113. echo $row['url'];
  
  114. echo '';
 
 
 Have you tried escaping the double quotes?
 echo '\';
 - -- 
 Nick Wilson //  www.explodingnet.com
 
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.0.6 (GNU/Linux)
 
 iD8DBQE87NI7HpvrrTa6L5oRAox5AJwJ5alFlqn0VtSTdLWKiQNVoKvZtQCgsEhj
 Umv5vrmmT8J0dDGSehyv5CU=
 =LknC
 -END PGP SIGNATURE-
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Parse Error(Newbie)

2002-05-23 Thread Rénald CASAGRAUDE

On jeudi, mai 23, 2002, at 01:27 , Nick Wilson wrote:

 I get a parse error on line 114 can anyone see the problem?

 Sorry if it is something obvious :}
 for ($i=0; $i $num_results; $i++)

 110. {
 111. $row = mysql_fetch_array($result);
 112. echo 'a href=';
 113. echo $row['url'];
 114. echo '';

 Have you tried escaping the double quotes?
 echo '\';

No !
echo '\';
will print :
\
Your line 114 is good

I don't see the problem but why not code like this :

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo 'A HREF=' . $row['url'] . ''.$row['site'].'/A';
}

If you don't see where is your problem, try to comment some
lines. Start with line 114... and execute your script to see
what happened.

R.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php