RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Beau Lebens
did you try echoing the value of $id after you have assigned it?

you may find it's because you aren't connected to your database or something

and also, i am assuming that you are using a recent install/verison of PHP,
because $_GET wasn't available until the last few releases.


beau

// -Original Message-
// From: Gavin Amm [mailto:gavin;ksg.com.au]
// Sent: Thursday, 7 November 2002 9:55 AM
// To: Php-Db (E-mail)
// Subject: [PHP-DB] Warning - newby question -- $_GET
// 
// 
// Hi,
// 
// I'm trying to call a script with the ?= after the php 
// script name in the
// URL, but can't seem to pick up the variable to use in my script...
// any help would be greatly appreciated :)
// 
// I'm calling the script with this url:
// http://localhost/Data/test/dbconnect2c.php?id=TestPage
// 
// The section of the script i'm using is:
// $id = $_GET['id'];
// $sql=SELECT * FROM content where title=$id;
// $result=mysql_query($sql,$db);
// 
// Error message returned:
// Warning: mysql_fetch_array(): supplied argument is not a 
// valid MySQL result
// resource in...
// 
// 
// Thanks,
// Gav
// 
// 
// This e-mail and any attachments are intended solely for the 
// named addressee,
// are confidential and may contain legally privileged information. 
// 
// The copying or distribution of them or of any information 
// they contain, by
// anyone other than the addressee, is prohibited. If you 
// received this e-mail
// in error, please notify us immediately by return e-mail or 
// telephone +61 2
// 9413 2944 and destroy the original message. Thank you. 
// 
// As Email is subject to viruses we advise that all Emails and 
// any attachments
// should be scanned by an up to-date Anti Virus programme 
// automatically by
// your system. It is the responsibility of the recipient to 
// ensure that all
// Emails and any attachments are cleared of Viruses before 
// opening. KSG can
// not accept any responsibility for viruses that maybe 
// contained here in.
// Please advise KSG by return Email if you believe any Email 
// sent by our
// system may contain a virus. It should be noted that most Anti Virus
// programmes can not scan encrypted file attachments (example 
// - documents
// saved with a password). Thus extra care should be taken when 
// opening these
// files. 
// 
// Liability limited by the Accountants Scheme, approved under 
// the Professional
// Standards Act 1994 (NSW). 
// 
// 
// 
// Level 4 
// 54 Neridah StreetPO Box 1290 
// CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 
// 
// 
// Ph: +61 2 9413 2944  Fax: +61 2 9413 9901
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
// 

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




RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread John W. Holmes
 I'm trying to call a script with the ?= after the php script name in
the
 URL, but can't seem to pick up the variable to use in my script...
 any help would be greatly appreciated :)
 
 I'm calling the script with this url:
 http://localhost/Data/test/dbconnect2c.php?id=TestPage
 
 The section of the script i'm using is:
 $id = $_GET['id'];
 $sql=SELECT * FROM content where title=$id;
 $result=mysql_query($sql,$db);

Well, for your example, $id is going to equal TestPage, so you are
making an invalid query: where title=TestPage. If you echo
mysql_error(), it'll probably say something about unknown column
TestPage.

At the very least, use quotes:

where title='$id'

 Error message returned:
 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
 result
 resource in...

This means your query failed. Echo mysql_error() to determine why. Get
used to using mysql_error for good debugging.

---John Holmes...



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




RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Gavin Amm
i wrote a really basic script sucessfully to echo the url variable to the
screen... will go from there. thanks beau.

EXCELLENT :)
The single quotes around the $id variable in the select statement worked
wonderfully. thanks John.

Gav



-Original Message-
From: John W. Holmes [mailto:holmes072000;charter.net]
Sent: Thursday, 7 November 2002 1:20 PM
To: 'Gavin Amm'; 'Php-Db (E-mail)'
Subject: RE: [PHP-DB] Warning - newby question -- $_GET


 I'm trying to call a script with the ?= after the php script name in
the
 URL, but can't seem to pick up the variable to use in my script...
 any help would be greatly appreciated :)
 
 I'm calling the script with this url:
 http://localhost/Data/test/dbconnect2c.php?id=TestPage
 
 The section of the script i'm using is:
 $id = $_GET['id'];
 $sql=SELECT * FROM content where title=$id;
 $result=mysql_query($sql,$db);

Well, for your example, $id is going to equal TestPage, so you are
making an invalid query: where title=TestPage. If you echo
mysql_error(), it'll probably say something about unknown column
TestPage.

At the very least, use quotes:

where title='$id'

 Error message returned:
 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
 result
 resource in...

This means your query failed. Echo mysql_error() to determine why. Get
used to using mysql_error for good debugging.

---John Holmes...



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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




Re: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Tony72284

   Well, first of all, you have to connect to the database.

?php
$db_server = localhost; // Usual server. :P
$db_login = USERNAME;
$db_pass = USERPASS;
mysql_connect($db_server,$db_login,$db_pass);
?
   
   And, its not always nesecary to have to type in $_GET['id'] to declare 
a GET variable. Some server software requires it, I think IIS is the only 
one, its what I use. 
   And its not required for you to use the 2nd prefex for mysql_query() 
Just as long as you connected to the DB at the beginning of the script, all 
you need is mysql_query($sql).

   That should clear up the error. As for you want to with the $result 
array, ask if needing help.



RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Gavin Amm
Hi,

For some reason the page worked the 1st few times, now I get the error
message (after making no changes to the code from when it worked...):
(line 5 references the $db = mysql_co... line of code)

Warning: Unknown MySQL Server Host 'mysql.db.*.net.au' (2) in
/home/.../public_html/public/index2.php on line 5

I've got the following code at the start of my script:
(i've replaced username and ** with the appropriate username 
password...)

?php
$db = mysql_connect(mysql.db.*.net.au, username, **);
mysql_select_db(kandtsg,$db);
...


cheers,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Peter Beckman
Make sure DNS is working and mysql.db.*.net.au resolves.  Better yet,
use the IP address unless absolutely necessary to use the hostname.

Peter

On Thu, 7 Nov 2002, Gavin Amm wrote:

 Hi,

 For some reason the page worked the 1st few times, now I get the error
 message (after making no changes to the code from when it worked...):
 (line 5 references the $db = mysql_co... line of code)

 Warning: Unknown MySQL Server Host 'mysql.db.*.net.au' (2) in
 /home/.../public_html/public/index2.php on line 5

 I've got the following code at the start of my script:
 (i've replaced username and ** with the appropriate username 
 password...)

 ?php
 $db = mysql_connect(mysql.db.*.net.au, username, **);
 mysql_select_db(kandtsg,$db);
 ...


 cheers,
 Gav


 This e-mail and any attachments are intended solely for the named addressee,
 are confidential and may contain legally privileged information.

 The copying or distribution of them or of any information they contain, by
 anyone other than the addressee, is prohibited. If you received this e-mail
 in error, please notify us immediately by return e-mail or telephone +61 2
 9413 2944 and destroy the original message. Thank you.

 As Email is subject to viruses we advise that all Emails and any attachments
 should be scanned by an up to-date Anti Virus programme automatically by
 your system. It is the responsibility of the recipient to ensure that all
 Emails and any attachments are cleared of Viruses before opening. KSG can
 not accept any responsibility for viruses that maybe contained here in.
 Please advise KSG by return Email if you believe any Email sent by our
 system may contain a virus. It should be noted that most Anti Virus
 programmes can not scan encrypted file attachments (example - documents
 saved with a password). Thus extra care should be taken when opening these
 files.

 Liability limited by the Accountants Scheme, approved under the Professional
 Standards Act 1994 (NSW).



 Level 4
 54 Neridah StreetPO Box 1290
 CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057


 Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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