Re: [PHP] Struggling with code

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 15:44, Ben C. wrote:
 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

Try using mysql_error() after each of your mysql_*() functions.


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

/*
Experience is not what happens to you; it is what you do with what happens
to you.
-- Aldous Huxley
*/


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




Re: [PHP] Struggling with code

2002-12-05 Thread Hugh Danaher
please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

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

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


 --
 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] Struggling with code

2002-12-05 Thread Ben C.
I have incorporated most of the suggestions.  My most recent code is:

?

$db_name = db1;
$table_name = user;

$connection = mysql_connect(localhost, user, password) or
die(Couldn't connect.);

$db = mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

$sql = UPDATE user
SET
name = '$name',
lname = '$lname',
mobil = '$mobil',
email = '$email',
url = '$url',
WHERE id= '$id'

;

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);


?

-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:07 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

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

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


 --
 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] Struggling with code

2002-12-05 Thread Ben C.
Hugh, I took away the comma from $url and it works.

Everyone, Thanks for your help!

Ben

-Original Message-
From: Ben C. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:15 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Struggling with code


I have incorporated most of the suggestions.  My most recent code is:

?

$db_name = db1;
$table_name = user;

$connection = mysql_connect(localhost, user, password) or
die(Couldn't connect.);

$db = mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

$sql = UPDATE user
SET
name = '$name',
lname = '$lname',
mobil = '$mobil',
email = '$email',
url = '$url',
WHERE id= '$id'

;

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);


?

-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:07 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

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

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


 --
 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


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




Re: [PHP] Struggling with code

2002-12-05 Thread Hugh Danaher
Great to hear it works!
I'd still consider using addslashes and the only way I've gotten it to work
is to write them in like the following:
url='.addslashes($url).'
Looks messy but works.  Oh, and stripslashes on the output too.
Good Night!
Hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 12:17 AM
Subject: RE: [PHP] Struggling with code


 Hugh, I took away the comma from $url and it works.

 Everyone, Thanks for your help!

 Ben

 -Original Message-
 From: Ben C. [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:15 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Struggling with code


 I have incorporated most of the suggestions.  My most recent code is:

 ?

 $db_name = db1;
 $table_name = user;

 $connection = mysql_connect(localhost, user, password) or
 die(Couldn't connect.);

 $db = mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = UPDATE user
 SET
 name = '$name',
 lname = '$lname',
 mobil = '$mobil',
 email = '$email',
 url = '$url',
 WHERE id= '$id'

 ;

 $result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
 query.);


 ?

 -Original Message-
 From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:07 AM
 To: Ben C.
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 please post lines 20 and 21, get rid of all @, the comma after url='$url'
 and show your most recent code.  Others have posted and given you good
 advice, you should incorporate their suggestions.

 hugh
 - Original Message -
 From: Ben C. [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 11:44 PM
 Subject: RE: [PHP] Struggling with code


  I am now getting the following error:
 
  Warning: Supplied argument is not a valid MySQL-Link resource in
  /home/httpd/vhosts/localhost/httpdocs/data/up.php
  on line 21
 
  Why do you think that is?
 
  -Original Message-
  From: Jason Wong [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, December 04, 2002 9:53 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Struggling with code
 
 
  On Thursday 05 December 2002 13:24, Ben C. wrote:
   I am struggling with the code below.  I keep getting the error
Couldn't
   execute query.  Please help me out, let me know where I am going
wrong.
  
   ?
  
   $db_name = db1;
   $table_name = user;
  
   $connection = @mysql_connect(localhost, user, password) or
   die(Couldn't connect.);
  
   $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
   database.);
  
   $sql = UPDATE $table_name
   SET
   name = \$name\,
   lname = \$lname\,
   mobil = \$mobil\,
   email = \$email\,
   url = \$url\,
   WHERE id= \$id\
   ;
  
   $result = @mysql_query($sql,$connection) or die(Couldn't execute
  query.);
  
   ?
 
  How about NOT masking the error message by using mysql_query(), instead
of
  @mysql_query(). And instead of using die(), use echo mysql_error().
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications Development *
 
  /*
  A rolling stone gathers no moss.
  -- Publilius Syrus
  */
 
 
  --
  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


 --
 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] Struggling with code

2002-12-05 Thread liljim
Ben, consider re-working this slightly:

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);

mysql_error() doesn't take any arguments (other than maybe a resource
identifier ($connection, in this case)): it simply outputs problems, which
allows you to diagnose what's wrong with your script. Try throwing a bum
query in there and see what you get (I'm guessing it would be not a valid
mysql resource on line 21/22, which you've already reported in another
e-mail).

This would be a better way of doing things:

$result = mysql_query($sql,$connection) or die(Query failure:  .
mysql_error());

-James


Ben C. [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hugh, I took away the comma from $url and it works.

 Everyone, Thanks for your help!

 Ben

 -Original Message-
 From: Ben C. [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:15 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Struggling with code


 I have incorporated most of the suggestions.  My most recent code is:

 ?

 $db_name = db1;
 $table_name = user;

 $connection = mysql_connect(localhost, user, password) or
 die(Couldn't connect.);

 $db = mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = UPDATE user
 SET
 name = '$name',
 lname = '$lname',
 mobil = '$mobil',
 email = '$email',
 url = '$url',
 WHERE id= '$id'

 ;

 $result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
 query.);


 ?

 -Original Message-
 From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:07 AM
 To: Ben C.
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 please post lines 20 and 21, get rid of all @, the comma after url='$url'
 and show your most recent code.  Others have posted and given you good
 advice, you should incorporate their suggestions.

 hugh
 - Original Message -
 From: Ben C. [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 11:44 PM
 Subject: RE: [PHP] Struggling with code


  I am now getting the following error:
 
  Warning: Supplied argument is not a valid MySQL-Link resource in
  /home/httpd/vhosts/localhost/httpdocs/data/up.php
  on line 21
 
  Why do you think that is?
 
  -Original Message-
  From: Jason Wong [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, December 04, 2002 9:53 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Struggling with code
 
 
  On Thursday 05 December 2002 13:24, Ben C. wrote:
   I am struggling with the code below.  I keep getting the error
Couldn't
   execute query.  Please help me out, let me know where I am going
wrong.
  
   ?
  
   $db_name = db1;
   $table_name = user;
  
   $connection = @mysql_connect(localhost, user, password) or
   die(Couldn't connect.);
  
   $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
   database.);
  
   $sql = UPDATE $table_name
   SET
   name = \$name\,
   lname = \$lname\,
   mobil = \$mobil\,
   email = \$email\,
   url = \$url\,
   WHERE id= \$id\
   ;
  
   $result = @mysql_query($sql,$connection) or die(Couldn't execute
  query.);
  
   ?
 
  How about NOT masking the error message by using mysql_query(), instead
of
  @mysql_query(). And instead of using die(), use echo mysql_error().
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications Development *
 
  /*
  A rolling stone gathers no moss.
  -- Publilius Syrus
  */
 
 
  --
  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




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




Re: [PHP] Struggling with code

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 16:43, Hugh Danaher wrote:
 Great to hear it works!
 I'd still consider using addslashes and the only way I've gotten it to work
 is to write them in like the following:
 url='.addslashes($url).'
 Looks messy but works. 

Messy indeed ;)  Why not $url = addslashes($url) beforehand THEN use it to 
construct the query?

 Oh, and stripslashes on the output too.

No need for stripslashes() when _retrieving_ from the db.

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

/*
People will do tomorrow what they did today because that is what they
did yesterday.
*/


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




Re: [PHP] Struggling with code

2002-12-04 Thread Tom Rogers
Hi,

Thursday, December 5, 2002, 3:24:15 PM, you wrote:
BC I am struggling with the code below.  I keep getting the error Couldn't
BC execute query.  Please help me out, let me know where I am going wrong.

BC ?

BC $db_name = db1;
BC $table_name = user;

BC $connection = @mysql_connect(localhost, user, password) or
BC die(Couldn't connect.);

BC $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
BC database.);

BC $sql = UPDATE $table_name
BC SET
BC name = \$name\,
BC lname = \$lname\,
BC mobil = \$mobil\,
BC email = \$email\,
BC url = \$url\,
BC WHERE id= \$id\
BC ;

BC $result = @mysql_query($sql,$connection) or die(Couldn't execute query.);

?

BC --
BC The content of this email message and any attachments are confidential and
BC may be legally privileged, intended solely for the addressee.  If you are
BC not the intended recipient, be advised that any use, dissemination,
BC distribution, or copying of this e-mail is strictly prohibited.  If you
BC receive this message in error, please notify the sender immediately by reply
BC email and destroy the message and its attachments.



do this to debug your code:

$result = @mysql_query($sql,$connection) or die(Couldn't execute query 
$sqlbr.mysql_error());

-- 
regards,
Tom


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




Re: [PHP] Struggling with code

2002-12-04 Thread Jason Wong
On Thursday 05 December 2002 13:24, Ben C. wrote:
 I am struggling with the code below.  I keep getting the error Couldn't
 execute query.  Please help me out, let me know where I am going wrong.

 ?

 $db_name = db1;
 $table_name = user;

 $connection = @mysql_connect(localhost, user, password) or
 die(Couldn't connect.);

 $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = UPDATE $table_name
   SET
   name = \$name\,
   lname = \$lname\,
   mobil = \$mobil\,
   email = \$email\,
   url = \$url\,
   WHERE id= \$id\
 ;

 $result = @mysql_query($sql,$connection) or die(Couldn't execute query.);

 ?

How about NOT masking the error message by using mysql_query(), instead of 
@mysql_query(). And instead of using die(), use echo mysql_error().

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

/*
A rolling stone gathers no moss.
-- Publilius Syrus
*/


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




Re: [PHP] Struggling with code

2002-12-04 Thread Hugh Danaher
try
$sql = UPDATE $table_name SET name = '.addslashes($name).', lname =
'.addslashes($lname).', mobil = '.addslashes($mobil).', email =
'.addslashes($email).',  url = '.addslashes($url).',  WHERE id= $id ;

// mysql needs single quote marks ( ' ) around input values that are not
numbers.  The addslashes keeps
// names like Al  Scar Face Capone or Nina O'Clock from causing your
script to puke.
Hugh

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 9:52 PM
Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

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

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


 --
 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] Struggling with code

2002-12-04 Thread Richard Baskett
Get rid of the double quotes around your variables so:

$sql = UPDATE $table_name SET name='$name', lname='$lname', mobil='$mobil'
etc etc etc

Cheers!

Rick

Sir my concern is not whether God is on our side. My great concern is to be
on God's side. - Abraham Lincoln

 On Thursday 05 December 2002 13:24, Ben C. wrote:
 I am struggling with the code below.  I keep getting the error Couldn't
 execute query.  Please help me out, let me know where I am going wrong.
 
 ?
 
 $db_name = db1;
 $table_name = user;
 
 $connection = @mysql_connect(localhost, user, password) or
 die(Couldn't connect.);
 
 $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);
 
 $sql = UPDATE $table_name
 SET
 name = \$name\,
 lname = \$lname\,
 mobil = \$mobil\,
 email = \$email\,
 url = \$url\,
 WHERE id= \$id\
 ;
 
 $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
 ?


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




RE: [PHP] Struggling with code

2002-12-04 Thread Ben C.
I am now getting the following error:

Warning: Supplied argument is not a valid MySQL-Link resource in
/home/httpd/vhosts/localhost/httpdocs/data/up.php
on line 21

Why do you think that is?

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 9:53 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


On Thursday 05 December 2002 13:24, Ben C. wrote:
 I am struggling with the code below.  I keep getting the error Couldn't
 execute query.  Please help me out, let me know where I am going wrong.

 ?

 $db_name = db1;
 $table_name = user;

 $connection = @mysql_connect(localhost, user, password) or
 die(Couldn't connect.);

 $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = UPDATE $table_name
   SET
   name = \$name\,
   lname = \$lname\,
   mobil = \$mobil\,
   email = \$email\,
   url = \$url\,
   WHERE id= \$id\
 ;

 $result = @mysql_query($sql,$connection) or die(Couldn't execute
query.);

 ?

How about NOT masking the error message by using mysql_query(), instead of
@mysql_query(). And instead of using die(), use echo mysql_error().

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

/*
A rolling stone gathers no moss.
-- Publilius Syrus
*/


--
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