Page 2 of 3

Posted: Sat May 26, 2007 1:31 pm
by volka
Erick020 wrote:Look, you can see in the $q echo, the INSERT is OK... all values are present...:
insert into BESTELLING (Afnemer_ID, Leads_Kind, Aantal, Betaald, Datetime) values ('87', 'HYPOTHEEK', '3', 'NO', '1180203353')
so, this is 100% OK.
but never mind, this is NOT important....
Ok, let me try it another way. What do you think is the purpose of mysql_query() or mysql_db_query()? What does it do? And therefore what happens if it isn't present?

Posted: Sat May 26, 2007 1:41 pm
by Erick020
volka wrote:
Erick020 wrote:Look, you can see in the $q echo, the INSERT is OK... all values are present...:
insert into BESTELLING (Afnemer_ID, Leads_Kind, Aantal, Betaald, Datetime) values ('87', 'HYPOTHEEK', '3', 'NO', '1180203353')
so, this is 100% OK.
but never mind, this is NOT important....
Ok, let me try it another way. What do you think is the purpose of mysql_query() or mysql_db_query()? What does it do? And therefore what happens if it isn't present?
This is very easy:

First you have a script to select some data, if the database is empty you get "no data", if there are any, you get a list of the data you have selected (script:Show_Leads_H.php).
From there you have to confirm your order and when you click on the "confirm link" you run Command_Leads_H.php and i must update the database, means I must put in all selected arrays (to find in the Show_Leads_H.php script) some informations like (company_ID).
The problem is that selected arrays get lost (on the script Show_Leads_H.php, I can see: <input type=hidden name=Aanvraag_ID[0] value=28>, <input type=hidden name=Aanvraag_ID[1] value=29>), and it suppose to update the arrays 28, 29... but this information get lost and will not update anything...

Do you get the picture?

Posted: Sat May 26, 2007 1:43 pm
by volka
That was so not my question.
What does the function mysql_query() do?

Posted: Sat May 26, 2007 1:46 pm
by Erick020
volka wrote:That was so not my question.
What does the function mysql_query() do?
Look, I am no expert... so if you get the picture, and understand what i am trying to do, please help me with a simple script, because i get really confused.
I must update some specific arrays that are defined on a page and I cannot send the info to the next page (the update script).

Posted: Sat May 26, 2007 1:47 pm
by Erick020
volka wrote:That was so not my question.
What does the function mysql_query() do?
Here the page:

http://sales.bestefinancieringen.nl/SCR ... k.php?A=87

don't change the settings, (only the first table works) --> choice: 1 0... click on SELECTEREN
then type 3 for exemple and click on TONEN and then on ORDER BEVESTIGEN

You can see I think what happends

Posted: Sat May 26, 2007 1:47 pm
by volka
What does mysql_query do? (mysql_query and mysql_db_query are similar)
see http://de2.php.net/mysql_query

Posted: Sat May 26, 2007 1:53 pm
by Erick020
volka wrote:What does mysql_query do? (mysql_query and mysql_db_query are similar)
see http://de2.php.net/mysql_query
mysql_query SELECT THE DATA THAT ARE SHOWN ON THE PAGE

Posted: Sat May 26, 2007 1:54 pm
by volka
no. Please read the manual page carefully.

Posted: Sat May 26, 2007 1:55 pm
by John Cartwright
Let me answer this question for you, it executes the query. If you do not execute the query, in your case the insert statement, then nothing will be inserted.

Posted: Sat May 26, 2007 1:59 pm
by Erick020
Jcart wrote:Let me answer this question for you, it executes the query. If you do not execute the query, in your case the insert statement, then nothing will be inserted.
I do NOT have any trouble with the INSERT.... it works fine...

The update (competely separate from the INSERT) does not work... so please just forget the INSERT... and help me to update several arrays at the same time..

I finally have on a page:

ID[0] = 1
ID[1] = 5
ID[3] = 8

and I need to update some data (lets say company_ID=87) into all these arrays, that's it

Posted: Sat May 26, 2007 2:02 pm
by John Cartwright
I meant update, not insert.

Posted: Sat May 26, 2007 2:06 pm
by Erick020
Jcart wrote:I meant update, not insert.
OK.... but before i start to write here I already tried many things and read the manual, but I don't understand... so if you know the right statement for doing that, please just send it as I suppose to use it (I can change the names).

Posted: Sat May 26, 2007 2:17 pm
by volka
Sorry, there is no easy fix.
There's a fundemental misunderstandig in
WHERE

'Aanvraag_ID[$i]' = 'Aanvraag_ID[$i]
and the flop trying to explain the lesser errors or strange things in the script I very much doubt I can explain this to you. Good luck anyway.

Posted: Sat May 26, 2007 2:19 pm
by Erick020
volka wrote:Sorry, there is no easy fix.
There's a fundemental misunderstandig in
WHERE

'Aanvraag_ID[$i]' = 'Aanvraag_ID[$i]
and the flop trying to explain the lesser errors or strange things in the script I very much doubt I can explain this to you. Good luck anyway.
Look this is what I mean... this is wrong, I know that....
If you understand what I want to do, don't try to fix what i did, just send what you think it should be.

Posted: Sat May 26, 2007 5:44 pm
by Chris Corbyn
Ok, take this line of code:

Code: Select all

$q = "UPDATE users SET last_login = NOW() WHERE id = '" . mysql_real_escape_string($userId) . "' LIMIT 1";
It does absolutely nothing other than create a string which we do nothing with.

Now take this:

Code: Select all

$q = "UPDATE users SET last_login = NOW() WHERE id = '" . mysql_real_escape_string($userId) . "' LIMIT 1";
mysql_query($q);
It runs that string as a MySQL query. You're missing the call to mysql_query() in your code.

I'll also take a wild stab in the dark that this bit of code:

Code: Select all

WHERE 

'Aanvraag_ID[$i]' = 'Aanvraag_ID[$i]
Should be:

Code: Select all

WHERE 

Aanvraag_ID = 'Aanvraag_ID[$i]