Re: [PHP-DB] Global Connection object

2002-05-02 Thread Lisi

Just put it in a separate file and include it in whatever page needs to 
access the DB.

-Lisi


At 10:03 AM 5/2/02 +1000, Shaun Johnston wrote:
Is it possible to make a MySQL connection object global, so that it doesn't
need to be declared as a parameter to be accessed from individual functions?



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




[PHP-DB] Re: php-db Digest 1 May 2002 19:24:34 -0000 Issue 1181

2002-05-02 Thread Dave Carrera

Hi Frank,

Thank you for the help and example you included in your reply.

With the help gained by all that answered I concocted this work around which
works perfectly.

I have included the code to help anyone else who needs this kind of result.
It has two table references

the first gets admin data and the seconds uses the admin data to reference
the 2nd table for all instances.


-- My Code Snippet -
$whichadminsql = select id, user from $tbn;

$whichadminres = mysql_query($whichadminsql);

while($adname = mysql_fetch_array($whichadminres)){

$adid = $adname[id];

$adnm = $adname[user];

$query = select count(admin_id) as Admin1 from $tbn3 where admin_id=$adid
;

$result = mysql_query($query);

$object = mysql_fetch_object($result);

$Admin[$i] = $object - Admin1;

$adminstatsshow .= $adnm has $Admin[$i] posts.br;

}

// Variables used are specific to my tables and needs and will need changing
to your suit your needs.

-- End My Code Snippet -

Once again Thank you





Frank Flynn [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Dave,

 The easiest, most direct, ANSI - SQL way to do what you ask is:

 SELECT count(*) as num_posts, Admin_id
   FROM your_table_Name
   WHERE optional but you could narrow the results here
   GROUP BY Admin_id
   ORDER BY Admin_id

 This will give you:

 num_posts  Admin_id
 -  
   3 1
   4 2
   5 3

 And naturally you can do whatever you like with these values in your PHP
 code.  The only potential got ya is if you had an Admin_id 4 who had no
 records you would not get 0, 4 you would not get a row for 4 at all.
There
 is a way around.  Ask me if you need it.

 Also GROUP BY has it's own kind of WHERE clause called HAVING.  The WHERTE
 clause operates on the raw data (like any other query) but HAVING works on
 the aggregate functions (like count, min, max, ave) so in this example we
 could add this line right after the GROUP BY:
   HAVING count(*)  4
 This would make the query only return the 5, 3 row.

 Good Luck,
 Frank

 On 5/1/02 12:24 PM, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:

  From: Dave Carrera [EMAIL PROTECTED]
  Date: Wed, 1 May 2002 13:02:51 +0100
  To: [EMAIL PROTECTED]
  Subject: Count and group ?
 
  Hi All
 
 
 
  I have added a row to my table which inputs which admin user has amended
  a record in a table on my db.
 
 
 
  I have this working but what I would like to do is count how many
  instances of the admin id I have stored.
 
 
 
  So if my list looks like this..
 
 
 
  Admin_id
 
  1
 
  2
 
  2
 
  2
 
  3
 
  3
 
  3
 
  3
 
  3
 
  2
 
  1
 
  1
 
  Then the result I would like to display is this..
 
 
 
  Admin (1) = 3 posts
 
  Admin (2) = 4 posts
 
  Admin (3) = 5 posts
 
 
 
  Basically displaying the total post each admin has made
 
 
 
  Any help or guidance is very appreciated and thank you in advance
 
 
 
  Dave Carrera
 
  Php Developer
 
  http://davecarrera.freelancers.net
 
  http://www.davecarrera.com
 
 




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




[PHP-DB] Session Problem, Please Help.....

2002-05-02 Thread Hayan AL Mamoun

Dear all, I have a strange problem:
I'm using IIS / WINNT4, PHP4
Please check these two files:
--
logon.phtml:
?
session_start();
session_register(CLIENTID);
$CLIENTID=SOMEVALUE;
header(Location: clients/editclient.phtml);
?
--
clients/editclient.phtml:
?
session_start();
echo CLient ID VALUE IS : $CLIENTID;
?

When I run logon.phtml, it must create a session variable called CLIENTID
and then move to the second page, which displays this variable.
Each time I test this code I start a new instant of the IE and request
logon.phtml (in order to create a new session), but it never works from the
first time, while if I tested it a second time from the same instance of IE
it works???!
Please could anyone help, why it dosn't work from the first time?

thnkx
Hayan


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




[PHP-DB] Form Submittion

2002-05-02 Thread PHP News

I have made function that automaticly inserts/updates the fields in a mysql
database from the $HTTP_POST_VARS variable. So when a user submits a form is
will autimaticly update the database. The problem I am having is that i need
to be able to submit unchecked checkboxes.

Does anyone know how to do this, or any workaround.

Thanks.

--
Cameron Cooke
Software Engineer
Toucan Resolve Ltd
Registered No 3900680
Tel: 01273 422288
Fax: 01273 272227
Email: [EMAIL PROTECTED]



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




Re: [PHP-DB] Form Submittion

2002-05-02 Thread James Treworgy

I have a work-in-progress class to handle update/edit of forms, but my
general strategy for checkboxes has been to include another hidden
field which has a value of 1 so you know that there should be an
accompanying field. e.g.

f_checkboxname is your checkbox
c_checkboxname is your fake field

in the loop where you go through all the  fields, look for antyhing
that starts with f_ or c_ and if you get a c_, look for the
accompanying f_. If it's got a value, then set the checkbox 1, else
set it zero

-- Jamie

Thursday, May 2, 2002, 8:39:12 AM, you wrote:

PN I have made function that automaticly inserts/updates the fields in a mysql
PN database from the $HTTP_POST_VARS variable. So when a user submits a form is
PN will autimaticly update the database. The problem I am having is that i need
PN to be able to submit unchecked checkboxes.

PN Does anyone know how to do this, or any workaround.

PN Thanks.

PN --
PN Cameron Cooke
PN Software Engineer
PN Toucan Resolve Ltd
PN Registered No 3900680
PN Tel: 01273 422288
PN Fax: 01273 272227
PN Email: [EMAIL PROTECTED]






-- 
Best regards,
 Jamesmailto:[EMAIL PROTECTED]


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




[PHP-DB] Re: Spaces Problem php mysql

2002-05-02 Thread Hugh Bothwell


Paul [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a form on one server which takes a name in one field, intentionally
 including spaces as a full name. That value shows up as a form variable as
I
 intended when I display it on the same server. It is sent to another
server
 and written to a mysql database there. At that time, only the first word
in
 the field is written. When the value is returned by the same php script
that
 received and wrote the database, the only thing left in the field is the
 first word. Length of the word seems to have nothing to do with this.

 I've been pounding my head (and the keyboard with searches) over this. Do
I
 have to take the first entry apart with string functions to get my desired
 end, which is the entire name in one field in the database?

... make sure the value is enclosed in quotes when you try
to insert it into the database, ie

INSERT INTO table ( name ) VALUES ( '$name' )



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




[PHP-DB] Re: Session Problem, Please Help.....

2002-05-02 Thread tatang

Hayan AL Mamoun wrote: 

try this 

logon.phtml:
?
session_start();
$CLIENTID=SOMEVALUE;
session_register(CLIENTID);
header(Location: clients/editclient.phtml);
? 

 --
clients/editclient.phtml:
?
session_start();
echo CLient ID VALUE IS : $CLIENTID;
? 

the deZayner
 
 

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




[PHP-DB] Using functions in SELECT statements

2002-05-02 Thread Robin S McKenzie


I'm trying perform a case-insensitive test for a name.  These are stored
like Association of ..., and I want to convert both the filter and the
test data to lower- (or upper-) case.  Why doesn't this work:   ?

SELECT *
FROM [Organisation Membership]
WHERE lower(organisation) LIKE lower('%$SearchBox$%')

Robin McKenzie
Department of Mechanical Engineering
University of Bristol
e:[EMAIL PROTECTED]
e:[EMAIL PROTECTED]
m:+44(0)7970 058712




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




FW: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread Peter Lovatt




Could it be the second $ in the lower('%$SearchBox$%') ?

Peter



---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
--- 

 -Original Message-
 From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
 Sent: 02 May 2002 14:34
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Using functions in SELECT statements
 
 
 
 I'm trying perform a case-insensitive test for a name.  These are stored
 like Association of ..., and I want to convert both the filter and the
 test data to lower- (or upper-) case.  Why doesn't this work:   ?
 
 SELECT *
 FROM [Organisation Membership]
 WHERE lower(organisation) LIKE lower('%$SearchBox$%')
 
 Robin McKenzie
 Department of Mechanical Engineering
 University of Bristol
 e:[EMAIL PROTECTED]
 e:[EMAIL PROTECTED]
 m:+44(0)7970 058712
 
 
 
 
 -- 
 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] Using functions in SELECT statements

2002-05-02 Thread Robin S McKenzie


If only it were that simple - sorry, that was a copying error...

It gives the error  undefined function: lower

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

Peter Lovatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...



 Could it be the second $ in the lower('%$SearchBox$%') ?

 Peter



 ---
 Excellence in internet and open source software
 ---
 Sunmaia
 www.sunmaia.net
 [EMAIL PROTECTED]
 tel. 0121-242-1473
 ---

  -Original Message-
  From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
  Sent: 02 May 2002 14:34
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Using functions in SELECT statements
 
 
 
  I'm trying perform a case-insensitive test for a name.  These are stored
  like Association of ..., and I want to convert both the filter and the
  test data to lower- (or upper-) case.  Why doesn't this work:   ?
 
  SELECT *
  FROM [Organisation Membership]
  WHERE lower(organisation) LIKE lower('%$SearchBox$%')
 
  Robin McKenzie
  Department of Mechanical Engineering
  University of Bristol
  e:[EMAIL PROTECTED]
  e:[EMAIL PROTECTED]
  m:+44(0)7970 058712
  
 
 
 
  --
  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] Using functions in SELECT statements

2002-05-02 Thread Tony James

Hi Robin


Instead of using sql to change the case of the search criteria try using php
as in the statement below

$query=
SELECT *
FROM [Organisation Membership]
WHERE lower(organisation) LIKE  '%. strtolower($SearchBox) .%');

Hope this is of some help to you
Tony James

- Original Message -
From: Robin S McKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 3:11 PM
Subject: Re: [PHP-DB] Using functions in SELECT statements



If only it were that simple - sorry, that was a copying error...

It gives the error  undefined function: lower

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

Peter Lovatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...



 Could it be the second $ in the lower('%$SearchBox$%') ?

 Peter



 ---
 Excellence in internet and open source software
 ---
 Sunmaia
 www.sunmaia.net
 [EMAIL PROTECTED]
 tel. 0121-242-1473
 ---

  -Original Message-
  From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
  Sent: 02 May 2002 14:34
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Using functions in SELECT statements
 
 
 
  I'm trying perform a case-insensitive test for a name.  These are stored
  like Association of ..., and I want to convert both the filter and the
  test data to lower- (or upper-) case.  Why doesn't this work:   ?
 
  SELECT *
  FROM [Organisation Membership]
  WHERE lower(organisation) LIKE lower('%$SearchBox$%')
 
  Robin McKenzie
  Department of Mechanical Engineering
  University of Bristol
  e:[EMAIL PROTECTED]
  e:[EMAIL PROTECTED]
  m:+44(0)7970 058712
  
 
 
 
  --
  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



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




RE: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread matt stewart

The problem is that you can't do a php function on a field name inside a
query, only on the contents after the query has already been executed!

The LIKE function in sql is case insensitive anyway, so you'll pull out all
the matches just by using:

$sql = SELECT * FROM Organisation_Membership WHERE organisation LIKE
'%$SearchBox';

if this is the wrong anser, and you were trying to do something different,
let me know!

Matt Stewart

[EMAIL PROTECTED]




-Original Message-
From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
Sent: 02 May 2002 15:11
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Using functions in SELECT statements



If only it were that simple - sorry, that was a copying error...

It gives the error  undefined function: lower

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

Peter Lovatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...



 Could it be the second $ in the lower('%$SearchBox$%') ?

 Peter



 ---
 Excellence in internet and open source software
 ---
 Sunmaia
 www.sunmaia.net
 [EMAIL PROTECTED]
 tel. 0121-242-1473
 ---

  -Original Message-
  From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
  Sent: 02 May 2002 14:34
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Using functions in SELECT statements
 
 
 
  I'm trying perform a case-insensitive test for a name.  These are stored
  like Association of ..., and I want to convert both the filter and the
  test data to lower- (or upper-) case.  Why doesn't this work:   ?
 
  SELECT *
  FROM [Organisation Membership]
  WHERE lower(organisation) LIKE lower('%$SearchBox$%')
 
  Robin McKenzie
  Department of Mechanical Engineering
  University of Bristol
  e:[EMAIL PROTECTED]
  e:[EMAIL PROTECTED]
  m:+44(0)7970 058712
  
 
 
 
  --
  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

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




Re: [PHP-DB] Session Problem, Please Help.....

2002-05-02 Thread szii

I believe it's because $CLIENTID is not set at ALL before you 
register it.  (ie, isset($CLIENTID) would fail)  Therefore it cannot
register the variable...there's nothing for it to register or track.

Try...

$CLIENTID = ;
session_register(CLIENTID);
$CLIENTID=SOMEVALUE;

- Original Message - 
From: Hayan AL Mamoun [EMAIL PROTECTED]
To: PHPList (E-mail) [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 3:15 AM
Subject: [PHP-DB] Session Problem, Please Help.


 Dear all, I have a strange problem:
 I'm using IIS / WINNT4, PHP4
 Please check these two files:
 --
 logon.phtml:
 ?
 session_start();
 session_register(CLIENTID);
 $CLIENTID=SOMEVALUE;
 header(Location: clients/editclient.phtml);
 ?
 --
 clients/editclient.phtml:
 ?
 session_start();
 echo CLient ID VALUE IS : $CLIENTID;
 ?
 
 When I run logon.phtml, it must create a session variable called CLIENTID
 and then move to the second page, which displays this variable.
 Each time I test this code I start a new instant of the IE and request
 logon.phtml (in order to create a new session), but it never works from the
 first time, while if I tested it a second time from the same instance of IE
 it works???!
 Please could anyone help, why it dosn't work from the first time?
 
 thnkx
 Hayan
 
 
 -- 
 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] Re: Spaces Problem php mysql

2002-05-02 Thread szii

- Original Message - 
From: Hugh Bothwell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 6:23 AM
Subject: [PHP-DB] Re: Spaces Problem php  mysql


  I've been pounding my head (and the keyboard with searches) over this. Do
 I
  have to take the first entry apart with string functions to get my desired
  end, which is the entire name in one field in the database?
 
 ... make sure the value is enclosed in quotes when you try
 to insert it into the database, ie
 
 INSERT INTO table ( name ) VALUES ( '$name' )

Make sure you escape out all single quotes in $name.

$name =  This is Paul's field.
.
.
.
INSERT INTO table ( name ) VALUES ( '$name' )

Will fail, because you have VALUES ('This is Paul');

Post the full value of $name via var_dump($name) and
var_dump($query) and we'll see what we can find with it.

'Luck

-Szii


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




[PHP-DB] Re: Using functions in SELECT statements

2002-05-02 Thread Kevin Stone

Your problem may be the use of single quotes around your wildcard search
string.  I haven't tested it but SQL probably works like PHP in that single
quotes denote exact values while double quotes allows evaluation of the
quoted string.
-Kevin

Robin S McKenzie [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I'm trying perform a case-insensitive test for a name.  These are stored
 like Association of ..., and I want to convert both the filter and the
 test data to lower- (or upper-) case.  Why doesn't this work:   ?

 SELECT *
 FROM [Organisation Membership]
 WHERE lower(organisation) LIKE lower('%$SearchBox$%')

 Robin McKenzie
 Department of Mechanical Engineering
 University of Bristol
 e:[EMAIL PROTECTED]
 e:[EMAIL PROTECTED]
 m:+44(0)7970 058712
 





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




RE: [PHP-DB] Re: Using functions in SELECT statements

2002-05-02 Thread Ryan Jameson (USA)

Is this in SQL server? It seems we don't have enough of the code to be able to tell 
the problem. The query has to be put in a  string and SearchBox has to exist, and this 
all has to be run from a query function, and  well, if you actually show your php 
code it would help quite a bit. :-)


-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 4:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Using functions in SELECT statements


Your problem may be the use of single quotes around your wildcard search
string.  I haven't tested it but SQL probably works like PHP in that single
quotes denote exact values while double quotes allows evaluation of the
quoted string.
-Kevin

Robin S McKenzie [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I'm trying perform a case-insensitive test for a name.  These are stored
 like Association of ..., and I want to convert both the filter and the
 test data to lower- (or upper-) case.  Why doesn't this work:   ?

 SELECT *
 FROM [Organisation Membership]
 WHERE lower(organisation) LIKE lower('%$SearchBox$%')

 Robin McKenzie
 Department of Mechanical Engineering
 University of Bristol
 e:[EMAIL PROTECTED]
 e:[EMAIL PROTECTED]
 m:+44(0)7970 058712
 





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




[PHP-DB] Re: Using functions in SELECT statements

2002-05-02 Thread Kevin Stone

(in response to my own response)

By the way it just occured to me that the default SELECT statement is
already case insensitive.  So is any of this is even necessary?  If you want
to display the selected items in lower case, then do that in your script
with strtolower();
-Kevin

Robin S McKenzie [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I'm trying perform a case-insensitive test for a name.  These are stored
 like Association of ..., and I want to convert both the filter and the
 test data to lower- (or upper-) case.  Why doesn't this work:   ?

 SELECT *
 FROM [Organisation Membership]
 WHERE lower(organisation) LIKE lower('%$SearchBox$%')

 Robin McKenzie
 Department of Mechanical Engineering
 University of Bristol
 e:[EMAIL PROTECTED]
 e:[EMAIL PROTECTED]
 m:+44(0)7970 058712
 





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




Re: [PHP-DB] Re: Spaces Problem php mysql

2002-05-02 Thread szii

AddSlashes() or AddCSlashes()

-Szii

- Original Message - 
From: Paul [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 4:11 PM
Subject: Re: [PHP-DB] Re: Spaces Problem php  mysql


 On Thursday 02 May 2002 10:10 am, you wrote:
  - Original Message -
  From: Hugh Bothwell [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, May 02, 2002 6:23 AM
  Subject: [PHP-DB] Re: Spaces Problem php  mysql
 
I've been pounding my head (and the keyboard with searches) over this.
Do
  
   I
  
have to take the first entry apart with string functions to get my
desired end, which is the entire name in one field in the database?
  
   ... make sure the value is enclosed in quotes when you try
   to insert it into the database, ie
  
   INSERT INTO table ( name ) VALUES ( '$name' )
 
  Make sure you escape out all single quotes in $name.
 
  $name =  This is Paul's field.
  .
  .
  .
  INSERT INTO table ( name ) VALUES ( '$name' )
 
  Will fail, because you have VALUES ('This is Paul');
 
  Post the full value of $name via var_dump($name) and
  var_dump($query) and we'll see what we can find with it.
 
  'Luck
 
  -Szii
 Thank you David and Szii. The urlencode solved the sending problem. But I've 
 had in the back of my mind to remember to deal with apostrophe's in names for 
 some time and just haven't done it. Good reminder. Is there any easier way to 
 do this than looping through each character in a string?
 
 Paul


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




[PHP-DB] url return

2002-05-02 Thread B.J.Rumsey

I have the following query:
$query = SELECT * FROM netjuke_tracks ORDER BY id DESC; 
$latemp3 = mysql_query($query) or die(Select Failed!); 
$latemp3 = mysql_fetch_array($latemp3);
echo Latest MP3 :nbsp;; echo $latemp3[name];

I also have a field called location which holds the file location. What I would like 
to know is how do I get it to return with the name as the name of the link and the url 
is the location of the link. 

Thanks in advance.

B.J.Rumsey



[PHP-DB] Re: url return

2002-05-02 Thread David Robley

In article 003101c1f23d$192952f0$0100a8c0@musicnircvthry, 
[EMAIL PROTECTED] says...
 I have the following query:
 $query = SELECT * FROM netjuke_tracks ORDER BY id DESC; 
 $latemp3 = mysql_query($query) or die(Select Failed!); 
 $latemp3 = mysql_fetch_array($latemp3);
 echo Latest MP3 :nbsp;; echo $latemp3[name];
 
 I also have a field called location which holds the file location. What I would 
like to know is how do I get it to return with the name as the name of the link and 
the url is the location of the link. 
 
 Thanks in advance.
 
 B.J.Rumsey
 
Just echo the appropriate HTML with the relevant variables added in the 
correct places.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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