[PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Hello There is a problem when I select a line in mysql table and afet I delete it. 1/ It works : $sql = 'SELECT * FROM table WHERE id=10 '; $req = mysql_query($sql) or die('Erreur SQL !br'.$sql.'br'.mysql_error()); while($data = mysql_fetch_assoc($req)) { echo $data['id']; } $sql2 = 'DELETE

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
$sql = 'SELECT * FROM table WHERE id='.$var.' '; $req = mysql_query($sql) or die('Erreur SQL !br'.$sql.'br'.mysql_error()); while($data = mysql_fetch_assoc($req)) { echo $data['id']; } $sql2 = 'DELETE FROM table WHERE id='.$var.' '; $req2 = mysql_query($sql2) or die('Erreur SQL

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Kendo Tom
Hi , For this situation , you should print out the SQL statement to check the value of the variable $var . -- From: David DURIEUX [EMAIL PROTECTED] Sent: Wednesday, September 03, 2008 5:07 PM To: php-db@lists.php.net Subject: [PHP-DB]

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
At the begining $var is $_GET['id'] and after I try directly $var = 10 but no changes. On the server directly, I can only try with the values : $sql = 'SELECT * FROM table WHERE id=10 '; and for this no problem. The problem is when I use a variable in query Best regards, David DURIEUX Tel :

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, I have print and it's OK, the query is good like if I put the value directly in the query Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
Did you actually echo the $sql? I know it works right now, but try to take away the quotes around the value in the query and see if something happens: $sql = SELECT * FROM table WHERE id={$var}; If that doesn't work then var_dump($sql, $var) and write us the result. Also let us know the data

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, No changes :/ I have always the same things Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3 Sep 2008 11:29:29 +0200

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
If that doesn't work then var_dump($sql, $var) and write us the result. Also let us know the data type of the ID column. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, string(40) SELECT * FROM table WHERE id=107 string(3) 107 string(38) DELETE FROM table WHERE id=107 string(3) 107 Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Micah Gersten
What does mysql_error return? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com David DURIEUX wrote: Bonjour, string(40) SELECT * FROM table WHERE id=107 string(3) 107 string(38) DELETE FROM table WHERE id=107 string(3) 107 Cordialement,

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
string(40) SELECT * FROM table WHERE id=107 string(3) 107 And this query works when you run it on the database directly? Id 107 exists? Assuming that that's both so we're running out of options. After the select, can you do a print of mysql_error() and of mysql_num_rows()? -- PHP Database

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, No error for mysql_error for all 2 queries. In fact the first return 0 results Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
In fact the first return 0 results So the problem is in your select, and if your select works when you manually insert the value for id (iow, without using $var), the problem has something to do with $var. Is the data type of the ID column INT? Try the following and let us know the output:

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône ID is INT. It's ok before. I have errors : Warning: Wrong parameter count for

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Micah Gersten
You have to pass mysql_num_rows a $result variable from your query. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com David DURIEUX wrote: Bonjour, Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
My bad, it should have the query handle as a parameter of course: $var=107; $query = mysql_query(SELECT * FROM table WHERE id={$var};) or die(mysql_error()); // make sure to use double quotes var_dump(mysql_error(), mysql_num_rows($query)); $var=mysql_real_escape_string(107); $query =

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, string(0) int(1) string(0) int(1) string(0) int(1) Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 03 Sep 2008

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
What does var_dump($_GET) say? On Wed, Sep 3, 2008 at 12:48 PM, David DURIEUX [EMAIL PROTECTED] wrote: Bonjour, The query works But when I wrote this : if (isset($_GET['deleteid'])){ $var=108; $query = mysql_query(SELECT * FROM table WHERE id={$var};) or

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, array(2) { [module]= string(12) sousdomaines [deleteid]= string(3) 133 } Note : The ID is good deleted but no select return Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
I have : array(2) { [module]= string(12) sousdomaines [deleteid]= string(3) 134 } But the ID is not deleted in mysql. That seems to be your var_dump($_GET), which means that either if (isset($_GET['deleteid'])) evaluates to FALSE or your SELECT does not return results. Let's check: if

[PHP-DB] CMS-Blog system

2008-09-03 Thread Martin Zvarík
Hi, I am working on CMS-Blog system, which will be using approx. 10 000 users. I have a basic question - I believe there are only two options - which one is better? 1) having separate databases for each blog = fast (problem: what if I will need to do search in all of the blogs for some

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, I Have now : string(3) 134 int(0) Lunch... NOT, I haven't the time today :p but cheese and sausage is good :) Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
string(3) 134 int(0) This means you're trying to delete the entry with id=3, and that it cannot find that in the database. Are you sure it exists? We tried the queries separately and the SELECT had no problem... SELECT * FROM table WHERE id=3; -- PHP Database Mailing List (http://www.php.net/)

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, Are you sur it is 3 ? it is 134 no? Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3 Sep 2008 14:17:59 +0200 Evert

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, Humm with this query I have forgotten to tell you the ID is DELETED Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
Humm with this query I have forgotten to tell you the ID is DELETED You mean the record with id=134? Are you sur it is 3 ? it is 134 no? You're right :-) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, Yes record exist before the query and is deleted after Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3 Sep 2008

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Dee Ayy
When using mysql_query, the SQL string to be executed should not end in a semicolon. Your initial post did not have a semicolon (but you obviously edited it to make it generic). Perhaps this was the initial problem? Subsequent posts had you terminating your queries with a semicolon. -- PHP

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
On Wed, Sep 3, 2008 at 7:41 PM, Dee Ayy [EMAIL PROTECTED] wrote: When using mysql_query, the SQL string to be executed should not end in a semicolon. Ending a query with a semicolon should not be a problem - the string is parsed by the mysql server, which handles it fine. -- PHP Database

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
On Wed, Sep 3, 2008 at 7:58 PM, Evert Lammerts [EMAIL PROTECTED] wrote: On Wed, Sep 3, 2008 at 7:41 PM, Dee Ayy [EMAIL PROTECTED] wrote: When using mysql_query, the SQL string to be executed should not end in a semicolon. Ending a query with a semicolon should not be a problem - the string

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, No, I must test a little more, I tell in few minutes Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3 Sep 2008

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Dee Ayy
On Wed, Sep 3, 2008 at 1:05 PM, Evert Lammerts [EMAIL PROTECTED] wrote: On Wed, Sep 3, 2008 at 7:58 PM, Evert Lammerts [EMAIL PROTECTED] wrote: On Wed, Sep 3, 2008 at 7:41 PM, Dee Ayy [EMAIL PROTECTED] wrote: When using mysql_query, the SQL string to be executed should not end in a semicolon.

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Dee Ayy
On Wed, Sep 3, 2008 at 8:35 PM, David DURIEUX [EMAIL PROTECTED] wrote: Bonjour, I have always the problem, select = 0 rows and it delete it like if delete is before the select :/ Cordialement, David DURIEUX Your SELECT has a terminating semicolon. Your DELETE does not. Some

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, Yes I'm using this query and no row select Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3 Sep 2008 20:43:25 +0200

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, PHP 5.2.6 on FreeBSD 7.0 i386 associate with apache 2.0.63 Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3 Sep 2008

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
But the DELETE is executed? If it is, and it's in the condition, like in the above code: if ($row = mysql_fetch_assoc($query)) { DELETE ... } something apparently is fetched On Wed, Sep 3, 2008 at 8:49 PM, David DURIEUX [EMAIL PROTECTED] wrote: Bonjour, Yes I'm using this

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, Yes DELETE is executed and I have on my page : string(3) 140 int(0) Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400 Villefranche sur Saône Le Wed, 3

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
This is weird. Can you send over the complete file? On Wed, Sep 3, 2008 at 8:56 PM, David DURIEUX [EMAIL PROTECTED] wrote: Bonjour, Yes DELETE is executed and I have on my page : string(3) 140 int(0) Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Evert Lammerts
Your SELECT has a terminating semicolon. I'm guessing Multiple statement execution is enabled by default... http://dev.mysql.com/doc/refman/5.0/en/mysql-query.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] Blank Page?

2008-09-03 Thread Chris Hale
I have a functions page: function connect() { include(includes/Vars.php); mysql_connect($host, $user, $passwd) or die(Couldn't connect to database); mysql_select_db($db) or die(Couldn't select database); } function pagecontent() switch($_GET[page]) { connect();

Re: [PHP-DB] Blank Page?

2008-09-03 Thread Evert Lammerts
Add the line: error_reporting(E_ALL); at the top of your functions page On Wed, Sep 3, 2008 at 9:29 PM, Chris Hale [EMAIL PROTECTED] wrote: I have a functions page: function connect() { include(includes/Vars.php); mysql_connect($host, $user, $passwd) or die(Couldn't connect to

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, The problem come from the a href= in the input submit With a href=text/a It works It is very Space Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847 route de Frans (Créacité) 69400

Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread David DURIEUX
Bonjour, I have make this to have a button, it's an error, it's the first time I have a problem with this. I'm sorry to have get your time. Cordialement, David DURIEUX Tel : 04.74.04.81.34 Port : 06.34.99.45.18 Mail : [EMAIL PROTECTED] Site Web : http://www.siprossii.com/ SIPROSSII 847

[PHP-DB] Separate or 1 database ?

2008-09-03 Thread Martin Zvarík
I have a basic question - I believe there are only two options - which one is better? 1) having separate databases for each blog = fast (problem: what if I will need to do search for article in all of the blogs for some?) 2) having all blogs in ONE database - that might be 10 000 * 100

Re: [PHP-DB] CMS-Blog system

2008-09-03 Thread Evert Lammerts
1) having separate databases for each blog = fast (problem: what if I will need to do search in all of the blogs for some article?) 2) having all blogs in one database - that might be 10 000 * 100 articles = too many rows, but easy to search and maintain, hmm? The answers on your question