Re: [PHP] Newbie ?: why this error?

2001-09-05 Thread Vicki

That's good to know. Thanks!

Vicki

 In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Cc Zona) wrote:

 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Vicki) wrote:
 
   $db = mysql_connect (hostname, user, password);
  
  if (!$db)
  {
  echo Error: Could not connect to database. Please try again later.;
  exit;
  }
 
 BTW, you can reduce that block down to a single line:
 
 $db = mysql_connect (hostname, user, password) or die(Error: Could 
 not connect to database. Please try again later.);
 
 See http://php.net/die for more info.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie ?: why this error?

2001-09-05 Thread Gary



Cc Zona wrote:

 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Vicki) wrote:
 
 
 $db = mysql_connect (hostname, user, password);

if (!$db)
{
echo Error: Could not connect to database. Please try again later.;
exit;
}

 
 BTW, you can reduce that block down to a single line:
 
 $db = mysql_connect (hostname, user, password) or die(Error: Could 
 not connect to database. Please try again later.);


echo the error.
$db = mysql_connect (hostname, user, password);
echo mysql_errno().: .mysql_error().BR;
Then you will know what the problem is.
BTW if you are using the Dreamweaver extension that shows you the 
includes, get rid of it. It will rewrite your includes where they are 
all the same.

Gary




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Newbie ?: why this error?

2001-09-04 Thread Jason Murray

 I've been stuck on this all afternoon. The opening PHP tag is 
 what's on line 8. 

You may have disabled the short PHP tags - namely, ? ?.

These tags conflict with XML specs. 

Try ?php instead of ?

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Newbie ?: why this error?

2001-09-04 Thread Jack Dempsey

Hi Vicki,

try this:

?
if (!$SampFirstName || !$SampLastName || !$SampEmail)
{
echo You have not entered all the required information. br; #-- you
need a semi colon here and

echo Please go back and try again.; #-- another echo here.
exit;
}

you could also do this:

?
if (!$SampFirstName || !$SampLastName || !$SampEmail)
{
echo You have not entered all the required information. br Please go back
and try again.;
exit;
}


Jack


-Original Message-
From: Vicki [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 9:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie ?: why this error?


Not only am I new to PHP, I'm new to programming altogether. I'm trying
to take it step by step, and my first big experiment was the script
below, used to enter info from a form into a mySQL database. I get the
following error message when it runs:

Parse error: parse error, expecting `','' or `';'' in
/www/ideasforimages/request_sample.php on line 8

I've been stuck on this all afternoon. The opening PHP tag is what's on
line 8. I've run other simple scripts with the same tag, so it doesn't
seem to be a problem with the server set-up or application. Any help
would be greatly appreciated!

Vicki

Here's the the first part of the script in question:

html
head
titleSample Request Results/title
/head
body

pThank you for requesting a sample. Here it is./p

?
if (!$SampFirstName || !$SampLastName || !$SampEmail)
{
echo You have not entered all the required information. br
Please go back and try again.;
exit;
}

$SampFirstName = addslashes ($SampFirstName);
$SampLastName  = addslashes ($SampLastName) ;
$SampEmail = addslashes ($SampEmail);

 $db = mysql_connect (hostname, user, password);

if (!$db)
{
echo Error: Could not connect to database. Please try again later.;
exit;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie ?: why this error?

2001-09-04 Thread Vicki

Well this is progress! My sloppy semicolons seem to have been the 
problem. The error message has now moved down to line 14, which in 
Dreamweaver 4 is the closing } of that code block.

Since the line numbers in the error messages don't seem to be exact, the 
problem is probably in the lines immediately following the code block:

$SampFirstName = addslashes ($SampFirstName);
$SampLastName  = addslashes ($SampLastName) ;
$SampEmail = addslashes ($SampEmail);

 $db = mysql_connect (hostname, user, password);

if (!$db)
{
echo Error: Could not connect to database. Please try again later.;
exit;
}

I'll start looking at these lines more closely now. Thanks for the help. 
I guess I was taking those error messages too literally and looking for 
the problem in the wrong place.

Vicki


In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Jack Dempsey) wrote:

 Hi Vicki,
 
 try this:
 
 ?
 if (!$SampFirstName || !$SampLastName || !$SampEmail)
 {
 echo You have not entered all the required information. br; #-- you
 need a semi colon here and
 
 echo Please go back and try again.; #-- another echo here.
 exit;
 }
 
 you could also do this:
 
 ?
 if (!$SampFirstName || !$SampLastName || !$SampEmail)
 {
 echo You have not entered all the required information. br Please go back
 and try again.;
 exit;
 }
 
 
 Jack


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie ?: why this error?

2001-09-04 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Vicki) wrote:

  $db = mysql_connect (hostname, user, password);
 
 if (!$db)
 {
 echo Error: Could not connect to database. Please try again later.;
 exit;
 }

BTW, you can reduce that block down to a single line:

$db = mysql_connect (hostname, user, password) or die(Error: Could 
not connect to database. Please try again later.);

See http://php.net/die for more info.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]