[PHP] PhP / MySQL problem

2007-08-29 Thread debussy007

Hi,

I created a form asking username, password, country, etc.
On the submit of this form I make a sql connection and update the database,
add the user.

The problem is that whenever the field 'password' is filled in,
it (I don't know what) is asking to confirm the change of the password.

I made a printscreen to clarify :

http://matthew16.free.fr/sql.jpg

This is what I get when I try to submit the form and I filled in field
password.
The users displayed in the pop-up are the MySQL users.

The php/sql code is the following :

mysql_select_db(mydb, $link) or die(mysql_error());
$query =
  INSERT INTO members (username,password,date_of_birth,e_mail,country)
VALUES ('.
  $_POST['username'].','.
  $_POST['password'].','.
  $_POST['dateofbirth'].','.
  $_POST['email'].','.
  $_POST['country'].');
$result = mysql_query($query, $link) or die($query .  -  . mysql_error());


Thank you for any help !
-- 
View this message in context: 
http://www.nabble.com/PhP---MySQL-problem-tf4349742.html#a12393567
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] PhP / MySQL problem

2007-08-29 Thread Ludovic André



Hi,

I created a form asking username, password, country, etc.
On the submit of this form I make a sql connection and update the database,
add the user.

The problem is that whenever the field 'password' is filled in,
it (I don't know what) is asking to confirm the change of the password.

I made a printscreen to clarify :

http://matthew16.free.fr/sql.jpg

This is what I get when I try to submit the form and I filled in field
password.
The users displayed in the pop-up are the MySQL users.
This has nothing to do with your PHP/MySQL, but it's a feature of your 
browser (you're using Firefox, aren't you?)
Did you use the functionnality remember the password ? If so, then the 
users listed here are the ones for whom you wanted to remember the 
password. Firefox tries to be smart in this case: if you're updating the 
password, it asks you which user has changed...


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



Re: [PHP] PhP / MySQL problem

2007-08-29 Thread Richard Lynch
On Wed, August 29, 2007 2:03 pm, debussy007 wrote:
 I created a form asking username, password, country, etc.
 On the submit of this form I make a sql connection and update the
 database,
 add the user.

 The problem is that whenever the field 'password' is filled in,
 it (I don't know what) is asking to confirm the change of the
 password.

 I made a printscreen to clarify :

 http://matthew16.free.fr/sql.jpg

 This is what I get when I try to submit the form and I filled in field
 password.
 The users displayed in the pop-up are the MySQL users.

 The php/sql code is the following :

 mysql_select_db(mydb, $link) or die(mysql_error());
 $query =
   INSERT INTO members
 (username,password,date_of_birth,e_mail,country)
 VALUES ('.
   $_POST['username'].','.
   $_POST['password'].','.
   $_POST['dateofbirth'].','.
   $_POST['email'].','.
   $_POST['country'].');
 $result = mysql_query($query, $link) or die($query .  -  .
 mysql_error());

I believe that browser is configured to remember passwords (BAD
IDEA!!!) and is asking you to confirm the change for its local memory.

I am 100% certain that whatever it is, it ain't PHP doing it. :-)

-- 
Please vote for this great band:
http://acl.mp3.com/feature/soundandjury/?band=COMPANY-OF-THIEVES

Requires email confirmation.
One vote per day per email limit.
Obvious ballot-stuffing will be revoked.

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



Re: [PHP] PhP / MySQL problem

2007-08-29 Thread debussy007

I'm using FF.
But it asks to confirm the change of password of my MySQL users.
If I comment the php/mysql lines in the .php files,
I do not have such a pop-up.



Ludovic André wrote:
 
 
 Hi,

 I created a form asking username, password, country, etc.
 On the submit of this form I make a sql connection and update the
 database,
 add the user.

 The problem is that whenever the field 'password' is filled in,
 it (I don't know what) is asking to confirm the change of the password.

 I made a printscreen to clarify :

 http://matthew16.free.fr/sql.jpg

 This is what I get when I try to submit the form and I filled in field
 password.
 The users displayed in the pop-up are the MySQL users.
 This has nothing to do with your PHP/MySQL, but it's a feature of your 
 browser (you're using Firefox, aren't you?)
 Did you use the functionnality remember the password ? If so, then the 
 users listed here are the ones for whom you wanted to remember the 
 password. Firefox tries to be smart in this case: if you're updating the 
 password, it asks you which user has changed...
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/PhP---MySQL-problem-tf4349742.html#a12394801
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

Good morning friends,

I have a script that collects data from a form and puts together a mysql 
query to search a database.
Now, everything worked fine until I added a few new form fields... now the 
$_POST['var'] don't reach the script...


I have about 20 to 25 form fields which are all taken into the query...

Now my question: is there a limit in the fields that I can use in the query 
string to query the database? Somehow the script doesn't even output the 
value of the POST data anymore... been using this stuff for years now, and 
i'm feeling really silly at the moment.


I'd appreciate any help.

Cheers!
Chris 


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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Zoltán Németh
2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:
 Good morning friends,
 
 I have a script that collects data from a form and puts together a mysql 
 query to search a database.
 Now, everything worked fine until I added a few new form fields... now the 
 $_POST['var'] don't reach the script...
 
 I have about 20 to 25 form fields which are all taken into the query...
 
 Now my question: is there a limit in the fields that I can use in the query 
 string to query the database? Somehow the script doesn't even output the 
 value of the POST data anymore... been using this stuff for years now, and 
 i'm feeling really silly at the moment.

AFAIK there is no limit in the number of fields in a query...
post some code please, otherwise I don't think anyone will be able to
help you

greets
Zoltán Németh

 
 I'd appreciate any help.
 
 Cheers!
 Chris 
 

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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel
Right, here we go... this page has about 1000 lines of code, so here the 
relevant stuff.


$s_query = SELECT * FROM database WHERE
kategorie LIKE '$s_cat' AND
marke LIKE '$s_marke' AND
leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
preis = '$s_preis_von' AND
preis = '$s_preis_bis'.$checkboxes.$sort_str;

I get the $checkboxes from the POST checkboxes, which looks like this (an 
example):


$kraftstoffart = $_POST['fueltype'];
if($kraftstoffart == 3) {
$checkboxes .= ;
}elseif($kraftstoffart == 2) {
$checkboxes .=  AND kraftstoffart = '2';
}elseif($kraftstoffart == 1) {
$checkboxes .=  AND kraftstoffart = '1';
}

and the $sort_str comes in like

$sort_by = $_POST['sort_by'];
$desc_asc = $_POST['desc_asc'];
$sort_str =  ORDER BY .$sort_by. .$desc_asc;


The query then just goes like
$do_q   = mysql_query($s_query) or die(mysql_error());

and that's it...  no errors shown, just the regular output which I had 
before I put the new fields in there. So no changes to what I've had 
before... but there should be changes *g*


I hope anybody can find some sense in what I'm writing here... hardly makes 
sense to me :oP


Cheers!







- Original Message - 
From: Zoltán Németh [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:36 AM
Subject: Re: [PHP] PHP  MySQL Problem



2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:

Good morning friends,

I have a script that collects data from a form and puts together a mysql
query to search a database.
Now, everything worked fine until I added a few new form fields... now 
the

$_POST['var'] don't reach the script...

I have about 20 to 25 form fields which are all taken into the query...

Now my question: is there a limit in the fields that I can use in the 
query

string to query the database? Somehow the script doesn't even output the
value of the POST data anymore... been using this stuff for years now, 
and

i'm feeling really silly at the moment.


AFAIK there is no limit in the number of fields in a query...
post some code please, otherwise I don't think anyone will be able to
help you

greets
Zoltán Németh



I'd appreciate any help.

Cheers!
Chris





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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Zoltán Németh
2007. 05. 21, hétfő keltezéssel 09.43-kor Christian Haensel ezt írta:
 Right, here we go... this page has about 1000 lines of code, so here the 
 relevant stuff.
 
 $s_query = SELECT * FROM database WHERE
  kategorie LIKE '$s_cat' AND
  marke LIKE '$s_marke' AND
  leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
  preis = '$s_preis_von' AND
  preis = '$s_preis_bis'.$checkboxes.$sort_str;
 
 I get the $checkboxes from the POST checkboxes, which looks like this (an 
 example):
 
 $kraftstoffart = $_POST['fueltype'];
 if($kraftstoffart == 3) {
  $checkboxes .= ;
 }elseif($kraftstoffart == 2) {
  $checkboxes .=  AND kraftstoffart = '2';
 }elseif($kraftstoffart == 1) {
  $checkboxes .=  AND kraftstoffart = '1';
 }
 
 and the $sort_str comes in like
 
 $sort_by = $_POST['sort_by'];
 $desc_asc = $_POST['desc_asc'];
 $sort_str =  ORDER BY .$sort_by. .$desc_asc;
 
 
 The query then just goes like
 $do_q   = mysql_query($s_query) or die(mysql_error());
 
 and that's it...  no errors shown, just the regular output which I had 
 before I put the new fields in there. So no changes to what I've had 
 before... but there should be changes *g*

actually there seems to be no problem with your query (besides that you
should check posted values first in order to avoid SQL injection)

you said in your first letter that $_POST['var'] don't reach the
script - I would guess the relevant part is not the query but rather
the form itself...

greets
Zoltán Németh

 
 I hope anybody can find some sense in what I'm writing here... hardly makes 
 sense to me :oP
 
 Cheers!
 
 
 
 
 
 
 
 - Original Message - 
 From: Zoltán Németh [EMAIL PROTECTED]
 To: Christian Haensel [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Monday, May 21, 2007 9:36 AM
 Subject: Re: [PHP] PHP  MySQL Problem
 
 
  2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:
  Good morning friends,
 
  I have a script that collects data from a form and puts together a mysql
  query to search a database.
  Now, everything worked fine until I added a few new form fields... now 
  the
  $_POST['var'] don't reach the script...
 
  I have about 20 to 25 form fields which are all taken into the query...
 
  Now my question: is there a limit in the fields that I can use in the 
  query
  string to query the database? Somehow the script doesn't even output the
  value of the POST data anymore... been using this stuff for years now, 
  and
  i'm feeling really silly at the moment.
 
  AFAIK there is no limit in the number of fields in a query...
  post some code please, otherwise I don't think anyone will be able to
  help you
 
  greets
  Zoltán Németh
 
 
  I'd appreciate any help.
 
  Cheers!
  Chris
 
  
 

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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

I thought so, too. But the part where it receives the data is this:

$s_marke  = $_POST['marke'];
$s_modell  = $_POST['modell'];
$s_preis_von = $_POST['preis_von'];
$s_preis_bis = $_POST['preis_bis'];
$s_mileage_von = $_POST['mileage_from'];
$s_mileage_bis = $_POST['mileage_to'];
$s_ez_von  = $_POST['ez_from'];
$s_ez_bis  = $_POST['ez_bis'];
$s_search_text = $_POST['search_text'];
$s_cat   = $_POST['cat'];
$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];

(part of it)

And this is the relevant part of the form

select name=kw_von
 option selected=selected value=0***/option
 option value=/60/option

 option value=/75/option
 option value=/90/option
 option value=8181/110/option
 option value=9292/125/option
 option value=110110/150/option
 option value=147147/200/option
 option value=184184/250/option
 option value=220220/300/option
 option value=257257/350/option
/select

The funny thing is that all vars are being received except for the last two:
$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];

I am s stuck here, it ain't even funny anymore *g* And my boss is, of 
course, waiting for a result. Howcome people don't get that programming 
sometimes really IS leaning back and closing your eyes *gr* :oP


Thanks for trying to help me :o)

Chris

- Original Message - 
From: Zoltán Németh [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:58 AM
Subject: Re: [PHP] PHP  MySQL Problem



2007. 05. 21, hétfő keltezéssel 09.43-kor Christian Haensel ezt írta:

Right, here we go... this page has about 1000 lines of code, so here the
relevant stuff.

$s_query = SELECT * FROM database WHERE
 kategorie LIKE '$s_cat' AND
 marke LIKE '$s_marke' AND
 leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
 preis = '$s_preis_von' AND
 preis = '$s_preis_bis'.$checkboxes.$sort_str;

I get the $checkboxes from the POST checkboxes, which looks like this (an
example):

$kraftstoffart = $_POST['fueltype'];
if($kraftstoffart == 3) {
 $checkboxes .= ;
}elseif($kraftstoffart == 2) {
 $checkboxes .=  AND kraftstoffart = '2';
}elseif($kraftstoffart == 1) {
 $checkboxes .=  AND kraftstoffart = '1';
}

and the $sort_str comes in like

$sort_by = $_POST['sort_by'];
$desc_asc = $_POST['desc_asc'];
$sort_str =  ORDER BY .$sort_by. .$desc_asc;


The query then just goes like
$do_q   = mysql_query($s_query) or die(mysql_error());

and that's it...  no errors shown, just the regular output which I had
before I put the new fields in there. So no changes to what I've had
before... but there should be changes *g*


actually there seems to be no problem with your query (besides that you
should check posted values first in order to avoid SQL injection)

you said in your first letter that $_POST['var'] don't reach the
script - I would guess the relevant part is not the query but rather
the form itself...

greets
Zoltán Németh



I hope anybody can find some sense in what I'm writing here... hardly 
makes

sense to me :oP

Cheers!







- Original Message - 
From: Zoltán Németh [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:36 AM
Subject: Re: [PHP] PHP  MySQL Problem


 2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:
 Good morning friends,

 I have a script that collects data from a form and puts together a 
 mysql

 query to search a database.
 Now, everything worked fine until I added a few new form fields... now
 the
 $_POST['var'] don't reach the script...

 I have about 20 to 25 form fields which are all taken into the 
 query...


 Now my question: is there a limit in the fields that I can use in the
 query
 string to query the database? Somehow the script doesn't even output 
 the

 value of the POST data anymore... been using this stuff for years now,
 and
 i'm feeling really silly at the moment.

 AFAIK there is no limit in the number of fields in a query...
 post some code please, otherwise I don't think anyone will be able to
 help you

 greets
 Zoltán Németh


 I'd appreciate any help.

 Cheers!
 Chris







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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Zoltán Németh
2007. 05. 21, hétfő keltezéssel 10.04-kor Christian Haensel ezt írta:
 I thought so, too. But the part where it receives the data is this:
 
 $s_marke  = $_POST['marke'];
 $s_modell  = $_POST['modell'];
 $s_preis_von = $_POST['preis_von'];
 $s_preis_bis = $_POST['preis_bis'];
 $s_mileage_von = $_POST['mileage_from'];
 $s_mileage_bis = $_POST['mileage_to'];
 $s_ez_von  = $_POST['ez_from'];
 $s_ez_bis  = $_POST['ez_bis'];
 $s_search_text = $_POST['search_text'];
 $s_cat   = $_POST['cat'];
 $kw_von   = $_POST['kw_von'];
 $kw_bis   = $_POST['kw_bis'];
 
 (part of it)
 
 And this is the relevant part of the form
 
 select name=kw_von
   option selected=selected value=0***/option
   option value=/60/option
 
   option value=/75/option
   option value=/90/option
   option value=8181/110/option
   option value=9292/125/option
   option value=110110/150/option
   option value=147147/200/option
   option value=184184/250/option
   option value=220220/300/option
   option value=257257/350/option
  /select
 
 The funny thing is that all vars are being received except for the last two:
 $kw_von   = $_POST['kw_von'];
 $kw_bis   = $_POST['kw_bis'];

and if you do a var_dump($_POST) what do you get?
are these values not showing up at all?
if so, then you should check whether they are within the form and
/form tags... I made that mistake once...

greets
Zoltán Németh

 
 I am s stuck here, it ain't even funny anymore *g* And my boss is, of 
 course, waiting for a result. Howcome people don't get that programming 
 sometimes really IS leaning back and closing your eyes *gr* :oP
 
 Thanks for trying to help me :o)
 
 Chris
 
 - Original Message - 
 From: Zoltán Németh [EMAIL PROTECTED]
 To: Christian Haensel [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Monday, May 21, 2007 9:58 AM
 Subject: Re: [PHP] PHP  MySQL Problem
 
 
  2007. 05. 21, hétfő keltezéssel 09.43-kor Christian Haensel ezt írta:
  Right, here we go... this page has about 1000 lines of code, so here the
  relevant stuff.
 
  $s_query = SELECT * FROM database WHERE
   kategorie LIKE '$s_cat' AND
   marke LIKE '$s_marke' AND
   leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
   preis = '$s_preis_von' AND
   preis = '$s_preis_bis'.$checkboxes.$sort_str;
 
  I get the $checkboxes from the POST checkboxes, which looks like this (an
  example):
 
  $kraftstoffart = $_POST['fueltype'];
  if($kraftstoffart == 3) {
   $checkboxes .= ;
  }elseif($kraftstoffart == 2) {
   $checkboxes .=  AND kraftstoffart = '2';
  }elseif($kraftstoffart == 1) {
   $checkboxes .=  AND kraftstoffart = '1';
  }
 
  and the $sort_str comes in like
 
  $sort_by = $_POST['sort_by'];
  $desc_asc = $_POST['desc_asc'];
  $sort_str =  ORDER BY .$sort_by. .$desc_asc;
 
 
  The query then just goes like
  $do_q   = mysql_query($s_query) or die(mysql_error());
 
  and that's it...  no errors shown, just the regular output which I had
  before I put the new fields in there. So no changes to what I've had
  before... but there should be changes *g*
 
  actually there seems to be no problem with your query (besides that you
  should check posted values first in order to avoid SQL injection)
 
  you said in your first letter that $_POST['var'] don't reach the
  script - I would guess the relevant part is not the query but rather
  the form itself...
 
  greets
  Zoltán Németh
 
 
  I hope anybody can find some sense in what I'm writing here... hardly 
  makes
  sense to me :oP
 
  Cheers!
 
 
 
 
 
 
 
  - Original Message - 
  From: Zoltán Németh [EMAIL PROTECTED]
  To: Christian Haensel [EMAIL PROTECTED]
  Cc: php-general@lists.php.net
  Sent: Monday, May 21, 2007 9:36 AM
  Subject: Re: [PHP] PHP  MySQL Problem
 
 
   2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:
   Good morning friends,
  
   I have a script that collects data from a form and puts together a 
   mysql
   query to search a database.
   Now, everything worked fine until I added a few new form fields... now
   the
   $_POST['var'] don't reach the script...
  
   I have about 20 to 25 form fields which are all taken into the 
   query...
  
   Now my question: is there a limit in the fields that I can use in the
   query
   string to query the database? Somehow the script doesn't even output 
   the
   value of the POST data anymore... been using this stuff for years now,
   and
   i'm feeling really silly at the moment.
  
   AFAIK there is no limit in the number of fields in a query...
   post some code please, otherwise I don't think anyone will be able to
   help you
  
   greets
   Zoltán Németh
  
  
   I'd appreciate any help.
  
   Cheers!
   Chris
  
  
 
  
 

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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

Guys

nevermind... stupid moron that I am I put a hidden action in the form whích 
I totally (!!) forgot... All my code is fine so far, and all is working 
perfectly... now that bloddy thing cost me 3 DAYS of work... sometimes I 
wonder if I should rather sell shoes than calling myself a webdeveloper and 
work at that job all day long... geez!


Anyhow, thanks for your help guys... time for Aspirin over here... laterz!

Chris

- Original Message - 
From: Zoltán Németh [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 10:16 AM
Subject: Re: [PHP] PHP  MySQL Problem



2007. 05. 21, hétfő keltezéssel 10.04-kor Christian Haensel ezt írta:

I thought so, too. But the part where it receives the data is this:

$s_marke  = $_POST['marke'];
$s_modell  = $_POST['modell'];
$s_preis_von = $_POST['preis_von'];
$s_preis_bis = $_POST['preis_bis'];
$s_mileage_von = $_POST['mileage_from'];
$s_mileage_bis = $_POST['mileage_to'];
$s_ez_von  = $_POST['ez_from'];
$s_ez_bis  = $_POST['ez_bis'];
$s_search_text = $_POST['search_text'];
$s_cat   = $_POST['cat'];
$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];

(part of it)

And this is the relevant part of the form

select name=kw_von
  option selected=selected value=0***/option
  option value=/60/option

  option value=/75/option
  option value=/90/option
  option value=8181/110/option
  option value=9292/125/option
  option value=110110/150/option
  option value=147147/200/option
  option value=184184/250/option
  option value=220220/300/option
  option value=257257/350/option
 /select

The funny thing is that all vars are being received except for the last 
two:

$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];


and if you do a var_dump($_POST) what do you get?
are these values not showing up at all?
if so, then you should check whether they are within the form and
/form tags... I made that mistake once...

greets
Zoltán Németh



I am s stuck here, it ain't even funny anymore *g* And my boss is, of
course, waiting for a result. Howcome people don't get that programming
sometimes really IS leaning back and closing your eyes *gr* :oP

Thanks for trying to help me :o)

Chris

- Original Message - 
From: Zoltán Németh [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:58 AM
Subject: Re: [PHP] PHP  MySQL Problem


 2007. 05. 21, hétfő keltezéssel 09.43-kor Christian Haensel ezt írta:
 Right, here we go... this page has about 1000 lines of code, so here 
 the

 relevant stuff.

 $s_query = SELECT * FROM database WHERE
  kategorie LIKE '$s_cat' AND
  marke LIKE '$s_marke' AND
  leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
  preis = '$s_preis_von' AND
  preis = '$s_preis_bis'.$checkboxes.$sort_str;

 I get the $checkboxes from the POST checkboxes, which looks like this 
 (an

 example):

 $kraftstoffart = $_POST['fueltype'];
 if($kraftstoffart == 3) {
  $checkboxes .= ;
 }elseif($kraftstoffart == 2) {
  $checkboxes .=  AND kraftstoffart = '2';
 }elseif($kraftstoffart == 1) {
  $checkboxes .=  AND kraftstoffart = '1';
 }

 and the $sort_str comes in like

 $sort_by = $_POST['sort_by'];
 $desc_asc = $_POST['desc_asc'];
 $sort_str =  ORDER BY .$sort_by. .$desc_asc;


 The query then just goes like
 $do_q   = mysql_query($s_query) or die(mysql_error());

 and that's it...  no errors shown, just the regular output which I had
 before I put the new fields in there. So no changes to what I've had
 before... but there should be changes *g*

 actually there seems to be no problem with your query (besides that you
 should check posted values first in order to avoid SQL injection)

 you said in your first letter that $_POST['var'] don't reach the
 script - I would guess the relevant part is not the query but rather
 the form itself...

 greets
 Zoltán Németh


 I hope anybody can find some sense in what I'm writing here... hardly
 makes
 sense to me :oP

 Cheers!







 - Original Message - 
 From: Zoltán Németh [EMAIL PROTECTED]

 To: Christian Haensel [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Monday, May 21, 2007 9:36 AM
 Subject: Re: [PHP] PHP  MySQL Problem


  2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt 
  írta:

  Good morning friends,
 
  I have a script that collects data from a form and puts together a
  mysql
  query to search a database.
  Now, everything worked fine until I added a few new form fields... 
  now

  the
  $_POST['var'] don't reach the script...
 
  I have about 20 to 25 form fields which are all taken into the
  query...
 
  Now my question: is there a limit in the fields that I can use in 
  the

  query
  string to query the database? Somehow the script doesn't even 
  output

  the
  value of the POST data anymore... been using this stuff for years 
  now,

  and
  i'm feeling really silly at the moment.
 
  AFAIK

Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Richard Lynch
On Mon, May 21, 2007 2:26 am, Christian Haensel wrote:
 Good morning friends,

 I have a script that collects data from a form and puts together a
 mysql
 query to search a database.
 Now, everything worked fine until I added a few new form fields... now
 the
 $_POST['var'] don't reach the script...

 I have about 20 to 25 form fields which are all taken into the
 query...

 Now my question: is there a limit in the fields that I can use in the
 query
 string to query the database? Somehow the script doesn't even output
 the
 value of the POST data anymore... been using this stuff for years now,
 and
 i'm feeling really silly at the moment.

 I'd appreciate any help.

POST data *does* have a limit, possibly, based on your selection of
browser/server software...

It's a ridiculously high limit however, so it seems more likely that
you just added a typo to your code.

Show us code to get an answer.

And estimate for us the size of the POST data as well.

Without those bits of info, our answers will be:

Maybe.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

Hi there, good morning,

as posted yesterday (I guess it kind of got overlooked by the nmber of posts 
here), I was such a dirk that I put a hidden action in my form that 
redirected the test page to another (currently running) form which didn't 
have the changes in it. So my test page showed me data of a live page... 
dumb me, I know. But after hours and hours of coding, I bet this even 
happens to the best out there :oP Little piece of code sticking somewhere 
and you don't even remember that it is there... that reminds me to continue 
writing the handbook to this website *g*


Have a great coding-day :o))

Chris

- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, May 22, 2007 2:42 AM
Subject: Re: [PHP] PHP  MySQL Problem



On Mon, May 21, 2007 2:26 am, Christian Haensel wrote:

Good morning friends,

I have a script that collects data from a form and puts together a
mysql
query to search a database.
Now, everything worked fine until I added a few new form fields... now
the
$_POST['var'] don't reach the script...

I have about 20 to 25 form fields which are all taken into the
query...

Now my question: is there a limit in the fields that I can use in the
query
string to query the database? Somehow the script doesn't even output
the
value of the POST data anymore... been using this stuff for years now,
and
i'm feeling really silly at the moment.

I'd appreciate any help.


POST data *does* have a limit, possibly, based on your selection of
browser/server software...

It's a ridiculously high limit however, so it seems more likely that
you just added a typo to your code.

Show us code to get an answer.

And estimate for us the size of the POST data as well.

Without those bits of info, our answers will be:

Maybe.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--
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] php-mysql problem

2007-04-03 Thread Me2resh Lists

hi
i need help regarding a sql query in my php app.

the query is :
   $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;

i want to sort this query by the number of the repeated EMail counts.
can anyone help me with that please ?


Re: [PHP] php-mysql problem

2007-04-03 Thread Jochem Maas
Me2resh Lists wrote:
 hi
 i need help regarding a sql query in my php app.
 
 the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 
 i want to sort this query by the number of the repeated EMail counts.
 can anyone help me with that please ?

somebody on a mysql mailing list per chance?
you are trying to solve a problem that is purely related to SQL query building,
this has nothing to do with php.

I would suggest you check out the mysql manual and read up on 'GROUP BY', 
'COUNT()'
and 'ORDER BY' - from your question I am guessing that these three hold the 
answer
to your problem between them

 

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



Re: [PHP] php-mysql problem

2007-04-03 Thread clive

Me2resh Lists wrote:

the query is :
   $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;


the only php I see it $SQL,$startingID,$items_numbers_list. This is a 
mysql question.


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



RE: [PHP] php-mysql problem

2007-04-03 Thread Jim Moseby
 i need help regarding a sql query in my php app.
 
 the query is :
 $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE 
 Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 
 i want to sort this query by the number of the repeated EMail counts.
 can anyone help me with that please ?


A)  Is this a PHP question?  If so, please post the PHP code you are having
trouble with.

B)  While you could dump the results of your query into an array, and use
sort() or the other array sorting methods to sort it any way you wanted to
(thus making this a PHP question), it would certainly be more efficient to
have MySQL return a properly sorted result set to begin with.

C)  It appears that by your use of DISTINCT(), you will not have repeating
EMail values in your result set, thus you could not sort it by repeating
emails. 

D)  You will find many more relevant answers and many more willing
participants if you were to post your question to a MySQL oriented list.

JM

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



Re: [PHP] php-mysql problem

2007-04-03 Thread cajbecu
clive wrote:
 Me2resh Lists wrote:
 the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 
 the only php I see it $SQL,$startingID,$items_numbers_list. This is a
 mysql question.
 

so, you don`t know the answer, right?

cajb.

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



Re: [PHP] php-mysql problem

2007-04-03 Thread Jochem Maas
cajbecu wrote:
 clive wrote:
 Me2resh Lists wrote:
 the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 the only php I see it $SQL,$startingID,$items_numbers_list. This is a
 mysql question.

 
 so, you don`t know the answer, right?

maybe he does maybe he doesn't - the point is trying to educate people
as to the best/correct place to ask questions. questions related purely
to SQL should be dealt with else where in cyberspace.

if I asked you whether your wife/girlfriend enjoyed having sex with
your best friend while you are at work then you may or may not know the
answer but it is hopefully clear that this is not the list to ask such a
question (but no doubt that there is a list somewhere that caters to that
kind of shit) ... conceptually what goes for your other half also goes for SQL.

 
 cajb.
 

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



Re: [PHP] php-mysql problem

2007-04-03 Thread clive

cajbecu wrote:

clive wrote:

Me2resh Lists wrote:

the query is :
   $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;

the only php I see it $SQL,$startingID,$items_numbers_list. This is a
mysql question.



so, you don`t know the answer, right?

cajb.

Well if I understand the question correctly, then yes I could have an 
answer.


I have solved something similar a while back, unfortunately I don't 
remember the correct sql and would have too populate a db table and try 
a few sql commands which is something me2resh should do until he gets 
the correct results.


clive

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



Re: [PHP] php-mysql problem

2007-04-03 Thread clive



if I asked you whether your wife/girlfriend enjoyed having sex with
your best friend while you are at work then you may or may not know the
answer but it is hopefully clear that this is not the list to ask such a
question (but no doubt that there is a list somewhere that caters to that
kind of shit) ... conceptually what goes for your other half also goes for SQL.


ha ha thats funny, but true and well explained :)
-

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



[PHP] php mysql problem

2006-05-02 Thread Ross

Just say I have a db

CREATE TABLE `mytable` (
  `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 3, 
7. I need to know

(a) when items are removed how can I sort the database to all the gaps are 
take out 1, 3, 7 becomes 1,2,3

(b) allow the ids to be changed so the items can change position in the 
list. If I change id 3 to id 1 then everything else shifts down.

If anyone has seen the amazon dvd rental list where you can swap dvd to the 
top of the list and delete this is what I am trying to achive with 
php/mysql. 

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



Fw: [PHP] php mysql problem

2006-05-02 Thread Satyam


- Original Message - 
From: Ross [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Tuesday, May 02, 2006 12:00 PM
Subject: [PHP] php mysql problem




Just say I have a db

CREATE TABLE `mytable` (
 `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
 PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 
3, 7. I need to know


(a) when items are removed how can I sort the database to all the gaps are 
take out 1, 3, 7 becomes 1,2,3


(b) allow the ids to be changed so the items can change position in the 
list. If I change id 3 to id 1 then everything else shifts down.


If anyone has seen the amazon dvd rental list where you can swap dvd to 
the top of the list and delete this is what I am trying to achive with 
php/mysql.


You are mixing up concepts here.  An ID is that, an identifier, and it goes 
with the record from its creation to its deletion.  That's what an ID is for 
(which in most Anglo legal systems is something people is not used to, an 
anthropological curiosity if you wish).  What you are looking for is an 
Order field (which, of course, you can name as you wish, since order is a 
reserved SQL word, I just give the concept of it), which is also numerical 
and that, if you put in your select  like Select * from mytalbe order by 
`order`, id will be used to order records and, if missing, will default to 
id.


Satyam

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



Re: [PHP] php mysql problem

2006-05-02 Thread tedd

At 11:00 AM +0100 5/2/06, Ross wrote:

Just say I have a db

CREATE TABLE `mytable` (
  `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 3,
7. I need to know

(a) when items are removed how can I sort the database to all the gaps are
take out 1, 3, 7 becomes 1,2,3


Ross:

I am sure that the advice of everyone here and on any mysql list will 
be NOT to do what you are asking. You're looking at the ID as if the 
order of that field means something, it shouldn't.


However, to provide you with what you asked for, please review:

/* Renumber the Existing Sequence
alter table mytable
drop id,
add id int unsigned not null auto_increment,
auto_increment = 1;

Keep in mind that by doing this, your dB should remain flat -- you 
cannot successfully renumber a relational dB without also considering 
all the dependant tables, which is not trivial.


HTH's more than it hurts.

tedd

--

http://sperling.com

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



Re: [PHP] php mysql problem

2006-05-02 Thread Wolf
Depending on your needs, here is another tack to think about (I know,
everyone else will be gasping and running for air...)

A few years ago I had to make a shopping cart.  I had an archaic system
that would not share information with my web/db server, so I had to
write a query to dump the products, quantity, price levels, etc out of
it to a CSV file.  I then used perl to get the file, reformat it into
SQL files, then run an empty of the table and recreate with all the data
that I just got off the server.

To get past the naming conventions and such and NOT lose any linked
tables, I did my joins and such off the product ID.  The Caveat to this
was that the products (even those we no longer sold) stayed in the
system for about 6 months, and by the time we were ready to purge those,
the orders were saved and could not be deleted (PDF and as saved data)
so that was never a problem.

That solved the product counts for me (since the bosses were a bit anal
about having accurate product counts and such) and kept that table tidy.

Customers was not so tidy, nor wore the other tables.  But you can only
work with what you can do.

In short, unless you have a very good reason and safety checks to keep
your data from getting lost from other tables, you might need to rethink
why you want that.

If you want to chew the fat and talk design, shoot me a message off-list
and I'll be glad to help.

Wolf

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



Re: [PHP] php mysql problem

2006-05-02 Thread John

Ross wrote:
This is my database now...I will use the item_id for the order but what if I 
want to change item_id 3 to item id 1? How can I push all the items down one 
place? How can I delete any gaps when items are deleted.



CREATE TABLE `board_papers` (
  `id` int(4) NOT NULL auto_increment,
  `doc_date` varchar(10) NOT NULL default '-00-00',
  `article_type` enum('agenda','minutes','paper') NOT NULL default 'agenda',
  `fileName` varchar(50) NOT NULL default '',
  `fileSize` int(4) NOT NULL default '0',
  `fileType` varchar(50) NOT NULL default '',
  `content` blob NOT NULL,
  `item_id` int(10) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;



-- snip --
Hi Ross,

You can reuse item_id after they have been deleted. So when you delete
item_id = 1, then next time you perform an insert, lookup the lowest
free item_id number and give it as the item_id. That's one small solution.

If you actually want to rank your records by more than just the item_id,
then define a field for each kind of rank you want, or better, add it as
a separate table, like:

board_papers - rank
* id
* board_papers_fk -- id from board_papers
* rank_type (example: readability, technicality...)
* rank_no (rank within the rank type)

Then you can order the board_papers after rank as you like!

Just an idea :)

Enjoy,
   John

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



Re: [PHP] php mysql problem

2006-05-02 Thread John

Ross wrote:
This is my database now...I will use the item_id for the order but what if I 
want to change item_id 3 to item id 1? How can I push all the items down one 
place? How can I delete any gaps when items are deleted.



CREATE TABLE `board_papers` (
  `id` int(4) NOT NULL auto_increment,
  `doc_date` varchar(10) NOT NULL default '-00-00',
  `article_type` enum('agenda','minutes','paper') NOT NULL default 'agenda',
  `fileName` varchar(50) NOT NULL default '',
  `fileSize` int(4) NOT NULL default '0',
  `fileType` varchar(50) NOT NULL default '',
  `content` blob NOT NULL,
  `item_id` int(10) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;



-- snip --
Hi Ross,

You can reuse item_id after they have been deleted. So when you delete
item_id = 1, then next time you perform an insert, lookup the lowest
free item_id number and give it as the item_id. That's one small solution.

If you actually want to rank your records by more than just the item_id,
then define a field for each kind of rank you want, or better, add it as
a separate table, like:

board_papers - rank
* id
* board_papers_fk -- id from board_papers
* rank_type (example: readability, technicality...)
* rank_no (rank within the rank type)

Then you can order the board_papers after rank as you like!

Just an idea :)

Enjoy,
   John

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



Re: [PHP] php mysql problem

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 5:00 am, Ross wrote:
 CREATE TABLE `mytable` (
   `id` int(4) NOT NULL auto_increment,
 `fileName` varchar(50) NOT NULL default '',
   PRIMARY KEY  (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


 when I add items they go id 1,2,3 etc. Whn I delete them gaps appear.
 1, 3,
 7. I need to know

 (a) when items are removed how can I sort the database to all the gaps
 are
 take out 1, 3, 7 becomes 1,2,3

You do *NOT* want to do this on an auto_increment field in a
relational database.

It's just a Bad Idea in so many ways...

For starters, you're going to need that 'id' field in a bunch of other
tables to relate the two tables -- That's kinda why they call it a
RELATIONAL database.

So if you re-number this table, you have to go through all the other
tables related to this table and update them as well.

You're looking at a cascading nightmare of updates.

 (b) allow the ids to be changed so the items can change position in
 the
 list. If I change id 3 to id 1 then everything else shifts down.

 If anyone has seen the amazon dvd rental list where you can swap dvd
 to the
 top of the list and delete this is what I am trying to achive with
 php/mysql.

THAT is another kettle of fish entirely.

You pretty much just need to manage the numbering on a different
column by hand

create table mytable(id int(11) auto_increment, rank int(4));

Queries you will find useful:

//The rank for the new item added to end of list:
select max(rank) + 1 from mytable;

//Queries to move to top of list:
$id = /* get ID of row here */
$rank = /* get current $rank of that row here */
update mytable set rank = rank + 1 where rank  $rank
update mytable set rank = 1 where id = $id

It's easy to mess up and get everything off by one but this is not
rocket science to figure out and debug.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] php - mysql problem

2006-04-14 Thread Jay Blanchard
[snip]
$sql = SELECT * FROM `table1` LEFT JOIN `table2` USING `id` WHERE ...
GROUP BY `table1`.`id`;

mysql_query($sql);

the problem is, that, when in table2 is not matching data using that id,
i lose that id from output array. but i don`t want to.. is there any
posibility to keep that id?
[/snip]

More of a mysql question but do a left outer join with no group by
statement.

SELECT table2.* 
FROM table1 LEFT OUTER JOIN table2 
ON(table1.id = table2.id)
WHERE table1.id IS NULL  


Returns all of table2 id's where there is no id in table1

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



Re: [PHP] php - mysql problem

2006-04-14 Thread cajbecu
thanks for your posting, but I have:

table1

id
name
value

table2

id
x
y

i want to

id name value x y

but there is no id from table 2 that is in table2.id and i want the
resource to bu something like this:

id(from table 1) name value (empty) (empty)

Jay Blanchard wrote:
 [snip]
 $sql = SELECT * FROM `table1` LEFT JOIN `table2` USING `id` WHERE ...
 GROUP BY `table1`.`id`;
 
 mysql_query($sql);
 
 the problem is, that, when in table2 is not matching data using that id,
 i lose that id from output array. but i don`t want to.. is there any
 posibility to keep that id?
 [/snip]
 
 More of a mysql question but do a left outer join with no group by
 statement.
 
 SELECT table2.* 
 FROM table1 LEFT OUTER JOIN table2 
 ON(table1.id = table2.id)
 WHERE table1.id IS NULL  
 
 
 Returns all of table2 id's where there is no id in table1
 

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



RE: [PHP] php - mysql problem

2006-04-14 Thread Jay Blanchard
[snip]
table1

id
name
value

table2

id
x
y

i want to

id name value x y

but there is no id from table 2 that is in table2.id and i want the
resource to bu something like this:

id(from table 1) name value (empty) (empty)


 SELECT table2.* 
 FROM table1 LEFT OUTER JOIN table2 
 ON(table1.id = table2.id)
 WHERE table1.id IS NULL  
[/snip]

 SELECT table1., *table2.* 
 FROM table1 LEFT OUTER JOIN table2 
 ON(table1.id = table2.id)

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



RE: [PHP] php - mysql problem

2006-04-14 Thread Jay Blanchard
[snip]
 SELECT table1., *table2.* 
 FROM table1 LEFT OUTER JOIN table2 
 ON(table1.id = table2.id)
[/snip]

Oops, typo.

SELECT table1.*, table2.* 
FROM table1 LEFT OUTER JOIN table2 
ON(table1.id = table2.id)

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



Re: [PHP] php - mysql problem

2006-04-14 Thread cajbecu
thanks a lot for your posting,


[cut]
Posted by Fred Mitchell on December 11 2004 2:47pm  [Delete] [Edit]

Let's say you are doing a LEFT JOIN with a table that shares a column
name in common with another table, and that you are selecting for
instances where the join is missing, that is IS NULL.

Normally, the common column name is wiped out by the null record, but
here is a workaround for it: You simply alias that common column name in
the select. For instance,

CREATE TABLE t1 (INT id NOT NULL, );
CREATE TABLE t2 (INT id NOT NULL, );
...
SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id
WHERE t2.id IS NULL;

would result in the column 'id' being null on each selected row.
Instead, you can do:

SELECT *, t1.id AS id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
WHERE t2.id IS NULL;

And now the 'id' column will be preserved since the alias is evaluated
*after* the LEFT JOIN.
[/cut]

pay attention to: -  *, t1.id  -

cheers,
cajbecu

Jay Blanchard wrote:
 [snip]
 $sql = SELECT * FROM `table1` LEFT JOIN `table2` USING `id` WHERE ...
 GROUP BY `table1`.`id`;
 
 mysql_query($sql);
 
 the problem is, that, when in table2 is not matching data using that id,
 i lose that id from output array. but i don`t want to.. is there any
 posibility to keep that id?
 [/snip]
 
 More of a mysql question but do a left outer join with no group by
 statement.
 
 SELECT table2.* 
 FROM table1 LEFT OUTER JOIN table2 
 ON(table1.id = table2.id)
 WHERE table1.id IS NULL  
 
 
 Returns all of table2 id's where there is no id in table1
 

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



[PHP] php-mysql problem

2004-05-13 Thread Jianping Zhu


I  have redhat 9.0 and Server version: Apache/2.0.40.
  i have installed rpms php-4.2.2-17.2.i386.rpm
   php-mysql-4.2.2-17.2.i386.rpm


   After i create a database called mydb and serveral tables in mysql,
   I tried to run following testdb.php script


   --
   html
   body
   ?php
   $db = mysql_connect(localhost, root,xx);
   mysql_select_db(mydb,$db);
   $result = mysql_query(SELECT * FROM employees,$db);
   printf(First Name: %sbr\n, mysql_result($result,0,first));
   printf(Last Name: %sbr\n, mysql_result($result,0,last));
   printf(Address: %sbr\n, mysql_result($result,0,address));
   printf(Position: %sbr\n, mysql_result($result,0,position));
   ?
   /body
   /html
   ---

   but i got error message with:
   http://coopunit.forestry.uga.edu:8080/testdb.php
   the error is:
   Fatal error: Call to undefined function:
   mysql_connect() in /var/www/html/testdb.php on line 13

   How can Fix this problem? Thanks
   

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



Re: [PHP] php-mysql problem

2004-05-13 Thread Oliver Hankeln
Hello,

[snip]

   but i got error message with:
   http://coopunit.forestry.uga.edu:8080/testdb.php
   the error is:
   Fatal error: Call to undefined function:
   mysql_connect() in /var/www/html/testdb.php on line 13
   How can Fix this problem? Thanks
[/snip]

Your PHP is compiled without mysql support (see 
http://coopunit.forestry.uga.edu:8080/test.php) You do however have dbx 
support. You might want to look at http://de.php.net/manual/de/ref.dbx.php
Your mysql_connect has to be replaced by dbx_connect and so on...
Alternativly you could recompile php with mysql support.

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


Re: [PHP] php-mysql problem

2004-05-13 Thread Jianping Zhu
Thank you for your response.
I get the php rpm distributed with redhat 9.0. 
Do I have to recompile phd instead from source code with mysql support?

Thanks



On Thu, May 13, 2004 at 06:15:23PM +0200, Oliver Hankeln wrote:
 Hello,
 
 [snip]
 
but i got error message with:
http://coopunit.forestry.uga.edu:8080/testdb.php
the error is:
Fatal error: Call to undefined function:
mysql_connect() in /var/www/html/testdb.php on line 13
 
How can Fix this problem? Thanks
 
 [/snip]
 
 
 Your PHP is compiled without mysql support (see 
 http://coopunit.forestry.uga.edu:8080/test.php) You do however have dbx 
 support. You might want to look at http://de.php.net/manual/de/ref.dbx.php
 Your mysql_connect has to be replaced by dbx_connect and so on...
 Alternativly you could recompile php with mysql support.
 
 HTH,
 Oliver Hankeln
 
 -- 
 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] php-mysql problem

2004-05-13 Thread John Nichel
Jianping Zhu wrote:
Thank you for your response.
I get the php rpm distributed with redhat 9.0. 
Do I have to recompile phd instead from source code with mysql support?

Thanks
You need to install the php-mysql rpm.  It will be on one of your Red 
Hat Discs.

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP /MySQL problem on SMP machines

2004-04-25 Thread Lasse Laursen
Hi all,

We just installed PHP 4.3.6 on FreeBSD 5.2.1 on some SMP machines and we are
experiencing some weird problems.

The PHP processes are running as FastCGI under Zeus with these compile
options:

./configure  --with-curl \
--enable-sockets \
--enable-dbx \
--with-jpeg-dir \
--with-jpeg \
--prefix=/webdisk/local/progs/php/compiled/4.3.6 \
--with-imlib \
--with-mysql \
--with-gd \
--enable-fastcgi \
--with-config-file-path=/webdisk/servers/php \
--with-exec-dir=/webdisk/servers/php/exec-dir \
--enable-memory-limit \
--disable-force-cgi-redirect \
--disable-url-fopen-wrapper \
--enable-track-vars \
--enable-xslt \
--with-xslt-sablot \
--enable-inline-optimization \
--disable-debug \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--with-ttf \
--with-freetype-dir=/usr/local/include/freetype2/ \
--with-zlib-dir=/usr/src/lib/libz/ \
--enable-gd-native-ttf \

The database backend is MySQL 4.0.18 and is run on a seperate dedicated
server.

Last night some problems occured - when we queried the databases for simple
queries that _should_ return some rows (and worked minutes before) the
database simply returned 0 rows. A restart og the mysqld and the php
processes solved the problems but they return at random.

I suspect that it is some weird problem with PHP / MySQL / SMP but I have no
clue what can cause the problem. The old servers we used before the upgrade
are all uni processor machines and we haven't experienced any similar
problems on those machines.

The sysctl for FreeBSD is set to: kern.ipc.shm_use_phys=1 (used on the old
setup as well)

Is there any issues with the mysql library under PHP that can cause the
problems on the server - eg. not thread safe?

I do hope that any of you have some pointers so I can get over this weird
problem.

Thanks in advance.

Regards
--
Lasse Laursen · VP, Hosting Technology · NetGroup A/S
St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark
Phone: +45 3370 1526 · Fax: +45 3313 0066

- Don't be fooled by cheap finnish imitations - BSD is the One True Code

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



Re: [PHP] PHP /MySQL problem on SMP machines

2004-04-25 Thread Curt Zirzow
* Thus wrote Lasse Laursen ([EMAIL PROTECTED]):
 Hi all,
 
 We just installed PHP 4.3.6 on FreeBSD 5.2.1 on some SMP machines and we are
 experiencing some weird problems.
 
...
 
 The database backend is MySQL 4.0.18 and is run on a seperate dedicated
 server.

What mysqlclient is php linked to?
  php -i | grep Client API

I would make sure you're using a 4.x version.

 
 Last night some problems occured - when we queried the databases for simple
 queries that _should_ return some rows (and worked minutes before) the
 database simply returned 0 rows. A restart og the mysqld and the php
 processes solved the problems but they return at random.

A couple things to check:
  - the output of mysql_error(), it usually solves 90% of query
  problems.

  - if myismchk was ran on the table(s) mysql can get confused
about the indexes (until the table(s) are flushed)


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] PHP /MySQL problem on SMP machines

2004-04-25 Thread Lasse Laursen
Hi Curt,

Thanks for your email - please find answers below:

Regards
--
Lasse Laursen · VP, Hosting Technology · NetGroup A/S
St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark
Phone: +45 3370 1526 · Fax: +45 3313 0066

- Don't be fooled by cheap finnish imitations - BSD is the One True Code
- Original Message - 
From: Curt Zirzow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, April 25, 2004 5:52 PM
Subject: Re: [PHP] PHP /MySQL problem on SMP machines


 * Thus wrote Lasse Laursen ([EMAIL PROTECTED]):
  Hi all,
 
  We just installed PHP 4.3.6 on FreeBSD 5.2.1 on some SMP machines and we
are
  experiencing some weird problems.
 
 ...
 
  The database backend is MySQL 4.0.18 and is run on a seperate dedicated
  server.

 What mysqlclient is php linked to?
   php -i | grep Client API

 I would make sure you're using a 4.x version.

webnode2# ./php -i | grep Client API
trtd class=eClient API version /tdtd class=v3.23.49 /td/tr

That could be one of the problems - how do I specify that I wish to use the
4.x API?

  Last night some problems occured - when we queried the databases for
simple
  queries that _should_ return some rows (and worked minutes before) the
  database simply returned 0 rows. A restart og the mysqld and the php
  processes solved the problems but they return at random.

 A couple things to check:
   - the output of mysql_error(), it usually solves 90% of query
   problems.

   - if myismchk was ran on the table(s) mysql can get confused
 about the indexes (until the table(s) are flushed)

No errors occur that give an mysql_error at any time. Queries on the
database simply returns the wrong information...

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



RE: [PHP] PHP, MySQL problem

2004-01-14 Thread Humberto Silva
 So, does anybody know what I the problem might be?

Hi,

Well you need to post the code so one can see what's the problem 
 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: Nicolai Elmqvist [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 14 de Janeiro de 2004 0:11
To: [EMAIL PROTECTED]
Subject: [PHP] PHP, MySQL problem


Hi

I have just started working with PHP and MySQL and have gone through 3
tutorials on how to add and delete records from a database. Nearly
everything is working, as it should except for the communication between
HTML form and PHP. If I try to add a record to my database by pushing
a submit the text in the textboxes are deleted but no record is
inserted in the database. I have copied the code directly form the
tutorials so spelling mistakes should not be the problem.



It is possible to add records manually in the code so the connection to
and from the database is ok.



So, does anybody know what I the problem might be?



I'm using PHP 4.3.4, MySQL 4.0.17 and an Apache server.



On before hand, thank you.

Nicolai Elmqvist

-- 
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] PHP,MySQL problem

2004-01-14 Thread Nicolai Elmqvist
Sorry, I should have done that from the beginning, but here it is. I have
looked further on the variables and it seams like the name attribute
sumbit (in the form) is not converted to the $submit variable when I
press the button. If I make a var_dump() in the beginning and end of the
code, $submit is set to NULL in both occations. The same goes with the rest
of the variables. It's like the conversion part is out of order, but where
can I fix that?

It is possible to update the database by setting the variables directly in
the code, so that is not the problem.
I have gone though my php.ini and httpd.conf files to see if there was any
mistakes. Found one but it didn't solve the problem.

Hope somebody can help.

Thanks!

The tutorial i have copied the code from can be found at:
http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html

Here is the code for making the database if anyone would like to test it.

CREATE TABLE employees (  id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT,
first varchar(20),  last varchar(20),  address varchar(255),  position
varchar(50),  PRIMARY KEY (id),  UNIQUE id (id));

Here is the script!

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN

html
head
titleIndex/title
/head
body

?php

$db = mysql_connect(localhost, root);
mysql_select_db(mydb,$db);

if ($submit) {
  // here if no ID then adding else we're editing
  if ($id) {
$sql = UPDATE employees SET
first='$first',last='$last',address='$address',position='$position' WHERE
id=$id;
  } else {
$sql = INSERT INTO employees (first,last,address,position) VALUES
('$first','$last','$address','$position');
  }
  // run SQL against the DB
  $result = mysql_query($sql);
  echo Record updated/edited!p;
} elseif ($delete) {
 // delete a record
$sql = DELETE FROM employees WHERE id=$id;
$result = mysql_query($sql);
echo $sql Record deleted!p;
} else {
 // this part happens if we don't press submit
  if (!$id) {
// print the list if there is not editing
$result = mysql_query(SELECT * FROM employees,$db);
while ($myrow = mysql_fetch_array($result)) {
  printf(a href=\%s?id=%s\%s %s/a \n, $PHP_SELF, $myrow[id],
$myrow[first], $myrow[last]);
   printf(a href=\%s?id=%sdelete=yes\(DELETE)/abr, $PHP_SELF,
$myrow[id]);
}
  }
  ?
  P
  a href=?php echo $PHP_SELF?ADD A RECORD/a
  P
  form method=post action=?php echo $PHP_SELF?
  ?php
  if ($id) {
// editing so select a record
$sql = SELECT * FROM employees WHERE id=$id;
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow[id];
$first = $myrow[first];
$last = $myrow[last];
$address = $myrow[address];
$position = $myrow[position];
// print the id for editing
?
input type=hidden name=id value=?php echo $id ?
?php
  }
  ?
  First name:input type=Text name=first value=?php echo $first
?br
  Last name:input type=Text name=last value=?php echo $last ?br
  Address:input type=Text name=address value=?php echo $address
?br
  Position:input type=Text name=position value=?php echo $position
?br
  input type=Submit name=submit value=Enter information
  /form
?php
}
?

/body
/html

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



Re: [PHP] PHP,MySQL problem

2004-01-14 Thread Richard Davey
Hello Nicolai,

Wednesday, January 14, 2004, 12:14:09 PM, you wrote:

NE Sorry, I should have done that from the beginning, but here it is. I have
NE looked further on the variables and it seams like the name attribute
NE sumbit (in the form) is not converted to the $submit variable when I

NE if ($submit) {

You probably have Register Globals turned off (you should do anyway,
PHP by default has this setting now). That article looks like it
assumed they were turned on.

Simple solution: if ($_POST['submit'])

You'll need to do this for each variable you want to use that comes in
via the form.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP] PHP, MySQL problem

2004-01-13 Thread Nicolai Elmqvist
Hi

I have just started working with PHP and MySQL and have gone through 3
tutorials on how to add and delete records from a database. Nearly
everything is working, as it should except for the communication between
HTML form and PHP. If I try to add a record to my database by pushing a
submit the text in the textboxes are deleted but no record is inserted in
the database. I have copied the code directly form the tutorials so spelling
mistakes should not be the problem.



It is possible to add records manually in the code so the connection to and
from the database is ok.



So, does anybody know what I the problem might be?



I'm using PHP 4.3.4, MySQL 4.0.17 and an Apache server.



On before hand, thank you.

Nicolai Elmqvist

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



[PHP] PHP-Mysql problem

2003-12-11 Thread Robin Kopetzky
Good Afternoon!!

I just installed RedHat Linux 9.0 with Apache/Php/MySql for a project. I
have Apache and PHP running. However, PHP does not have the Mysql module??
installed and this is the key to our project. Could someone point me in the
right direction to recompile PHP with proper MySql module included?? I am a
EXTREME newbie when it comes to compiling anything in Linux.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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



Re: [PHP] PHP-Mysql problem

2003-12-11 Thread Blake Schroeder
This is a good tutorial and it starts off with installiing php and mysql

http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html

Robin Kopetzky wrote:

Good Afternoon!!

I just installed RedHat Linux 9.0 with Apache/Php/MySql for a project. I
have Apache and PHP running. However, PHP does not have the Mysql module??
installed and this is the key to our project. Could someone point me in the
right direction to recompile PHP with proper MySql module included?? I am a
EXTREME newbie when it comes to compiling anything in Linux.
Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
 

--

+-+-++
| Blake Schroeder | Owner/Developer |lhwd.net|
+--(http://www.lhwd.net)+--/3174026352\--+
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP-Mysql problem

2003-12-11 Thread Ray Hunter
   I just installed RedHat Linux 9.0 with Apache/Php/MySql for a project. I
 have Apache and PHP running. However, PHP does not have the Mysql module??
 installed and this is the key to our project. Could someone point me in the
 right direction to recompile PHP with proper MySql module included?? I am a
 EXTREME newbie when it comes to compiling anything in Linux.

Did you install apache/php/mysql as rpms?

If you did then all you need to do is install the php-mysql rpm.

--
Ray

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



RE: [PHP] PHP + MySQL problem (strange behavior)

2001-12-07 Thread Javier Muniz

Unfortunately, mysql returns no error string.  MySQL doesn't appear to think
it's
an error, as it does apply changes to the row I'm trying to change, it
simple isn't
applying the CORRECT change to said row :)

-Javier

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 05, 2001 4:59 PM
To: Javier Muniz; '[EMAIL PROTECTED]'
Subject: Re: [PHP] PHP + MySQL problem (strange behavior)


On Thu,  6 Dec 2001 08:32, Javier Muniz wrote:
 Hello,

 I'm having trouble determining what's going wrong with a MySQL query
 that I'm doing from PHP.  Now before you go blaming MySQL read on :)

 I have a table with the following columns:
 id (int)
 name (varchar 20)
 starttime (int)
 duration (int)

 now, i have a row that has a starttime of 60, when i attempt to do the
 following update with PHP, it sets it to 0:

 UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname'

 but when I run it from the MySQL command line, copy/pasted from the
 code, it sets the value of starttime to 30 as expected.

 Anyone have any clue why this is?

mysql_error() is a good debugging tool; it will return an error string 
that may be useful.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A waist is a terrible thing to mind.

-- 
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] PHP + MySQL problem (strange behavior)

2001-12-05 Thread Javier Muniz

Hello,

I'm having trouble determining what's going wrong with a MySQL query that
I'm doing from PHP.  Now before you go blaming MySQL read on :)

I have a table with the following columns:
id (int)
name (varchar 20)
starttime (int)
duration (int)

now, i have a row that has a starttime of 60, when i attempt to do the
following update with PHP, it sets it to 0:

UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname'

but when I run it from the MySQL command line, copy/pasted from the code, it
sets the value of starttime to 30 as expected.

Anyone have any clue why this is?


Javier Muniz
Chief Technology Officer
Granicus, LTD.
Tel: (415) 522-5216
Fax: (415) 522-5215


-- 
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] PHP + MySQL problem (strange behavior)

2001-12-05 Thread David Robley

On Thu,  6 Dec 2001 08:32, Javier Muniz wrote:
 Hello,

 I'm having trouble determining what's going wrong with a MySQL query
 that I'm doing from PHP.  Now before you go blaming MySQL read on :)

 I have a table with the following columns:
 id (int)
 name (varchar 20)
 starttime (int)
 duration (int)

 now, i have a row that has a starttime of 60, when i attempt to do the
 following update with PHP, it sets it to 0:

 UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname'

 but when I run it from the MySQL command line, copy/pasted from the
 code, it sets the value of starttime to 30 as expected.

 Anyone have any clue why this is?

mysql_error() is a good debugging tool; it will return an error string 
that may be useful.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A waist is a terrible thing to mind.

-- 
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] PHP / mySQL Problem

2001-02-28 Thread Michael Gorner

Hello,

First a bit of background, I'm running apache 1.3.12, php 4.03 and MySQL
3.23.22 under the Windows platform.

My problem is simply that when I write stuff to database tables full stops
are represented as copyright symbols when I view the data again. This is
probably me just being stupid - I'm guessing I've overlooked something
obvious.

If you need more information just ask me,

Thanks in advance,

Michael Gorner.


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