Re: PHP & MySQL Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" <znemeth@xxxxxxxxxxxxxx>
To: "Christian Haensel" <php@xxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Monday, May 21, 2007 10:16 AM
Subject: Re:  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="44">44/60</option>

  <option value="55">55/75</option>
  <option value="66">66/90</option>
  <option value="81">81/110</option>
  <option value="92">92/125</option>
  <option value="110">110/150</option>
  <option value="147">147/200</option>
  <option value="184">184/250</option>
  <option value="220">220/300</option>
  <option value="257">257/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 soooo 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 *grrrrr* :oP

Thanks for trying to help me :o)

Chris

----- Original Message ----- From: "Zoltán Németh" <znemeth@xxxxxxxxxxxxxx>
To: "Christian Haensel" <php@xxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Monday, May 21, 2007 9:58 AM
Subject: Re:  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" <znemeth@xxxxxxxxxxxxxx>
>> To: "Christian Haensel" <php@xxxxxxxxx>
>> Cc: <php-general@xxxxxxxxxxxxx>
>> Sent: Monday, May 21, 2007 9:36 AM
>> Subject: Re:  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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux