Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration

catch the error

2009-02-26 Thread PJ
What is wrond with this file? same identical insert works from console but not from this file :-( html head titleUntitled/title /head body ? //include (lib/db1.php);// Connect to database mysql_connect('biggie', 'user', 'password', 'test'); $sql1 = INSERT INTO example (name, age) VALUES

Re: catch the error

2009-02-26 Thread Darryle Steplight
Hi PJ, Could it be that you have //include (lib/db1.php); commented out? Try uncommenting that line and see what happens. The error message will always print because the query is never executing properly if you have the db connections file commented out. On Thu, Feb 26, 2009 at 12:28 PM, PJ

Re: catch the error

2009-02-26 Thread PJ
It is commented out because I am using mysql_connect I don't think it would be good to use both, since the db1 references another db. But even when I use the db1.php and change the database and table, I get the same error message. But what I did miss is my typo in What is wrond with this

Re: catch the error

2009-02-26 Thread Jim Lyons
what's the error message? On Thu, Feb 26, 2009 at 11:46 AM, PJ af.gour...@videotron.ca wrote: It is commented out because I am using mysql_connect I don't think it would be good to use both, since the db1 references another db. But even when I use the db1.php and change the database and

RE: Upgrade story / request for insight

2009-02-26 Thread Jerry Schwartz
-Original Message- From: walterh...@gmail.com [mailto:walterh...@gmail.com] On Behalf Of Walter Heck Sent: Wednesday, February 25, 2009 11:43 PM To: Jerry Schwartz Cc: Gary W. Smith; Claudio Nanni; MySql Subject: Re: Upgrade story / request for insight Maybe this could help you:

Re: catch the error

2009-02-26 Thread Ricardo Dias Marques
Hi PJ, On Thu, Feb 26, 2009 at 17:28, PJ af.gour...@videotron.ca wrote: What is wrond with this file? same identical insert works from console but not from this file :-( [snip] ? //include (lib/db1.php);    // Connect to database mysql_connect('biggie', 'user', 'password', 'test');

Re: catch the error

2009-02-26 Thread Darryle Steplight
ok, well if that's the case then do this $db = mysql_connect('biggie', 'user', 'password', 'test'); That should fix the problem. On Thu, Feb 26, 2009 at 12:46 PM, PJ af.gour...@videotron.ca wrote: It is commented out because I am using mysql_connect I don't think it would be good to use

Re: [PHP] catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 12:28 -0500, PJ wrote: What is wrond with this file? same identical insert works from console but not from this file :-( html head titleUntitled/title /head body ? //include (lib/db1.php); // Connect to database mysql_connect('biggie',

Re: catch the error

2009-02-26 Thread PJ
Jim Lyons wrote: what's the error message? it's in the script/// Error performing query: of Error performing 1st query: - whatever I input. But I had an error in the include location... that's fixed and it works, but not the rest as corrected: ? //include (../lib/db1.php);// Connect to

Re: catch the error

2009-02-26 Thread PJ
Ricardo Dias Marques wrote: Hi PJ, On Thu, Feb 26, 2009 at 17:28, PJ af.gour...@videotron.ca wrote: What is wrond with this file? same identical insert works from console but not from this file :-( [snip] ? //include (lib/db1.php);// Connect to database mysql_connect('biggie',

Re: catch the error

2009-02-26 Thread PJ
Darryle Steplight wrote: ok, well if that's the case then do this $db = mysql_connect('biggie', 'user', 'password', 'test'); Ashley pointed out that the 4th parameter is not right - belongs in mysql_select_db. Here it is corrected: (but it still does not work) ? //include (../lib/db1.php);

Re: catch the error

2009-02-26 Thread Darryle Steplight
Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here is trying to help you and that's cool, but EVERYONE on this list may not be so nice. The above credentials is definitely the type of information you want to keep private, unless you

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
-Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 11:27 AM To: Jerry Schwartz Cc: a...@ashleysheridan.co.uk; 'Gary W. Smith'; 'MySql'; php- gene...@lists.php.net Subject: Re: [PHP] RE: non-auto increment question Jerry Schwartz wrote: Being

RE: catch the error

2009-02-26 Thread Jerry Schwartz
-Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 12:28 PM To: php-gene...@lists.php.net; MySql Subject: catch the error What is wrond with this file? same identical insert works from console but not from this file :-( html head

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result =

Re: [PHP] Re: catch the error

2009-02-26 Thread Darryle Steplight
Additionally regarding the error handling , add this to the op of your script. ini_set(display_errors,true); error_reporting(E_STRICT|E_ALL); and post the output of your error message. On Thu, Feb 26, 2009 at 1:40 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Thu, 2009-02-26 at 13:34

Re: catch the error

2009-02-26 Thread PJ
Jerry Schwartz wrote: -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 12:28 PM To: php-gene...@lists.php.net; MySql Subject: catch the error What is wrond with this file? same identical insert works from console but not from this

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here is trying to help you and that's cool, but EVERYONE on this list may not be so nice. The

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Here's the working code... ? //include (../lib/db1.php);// Connect to database $db_host = ''; $db_user = ''; $db_pass = ''; $db_name = ''; $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name,$db); $sql1 = INSERT INTO test (name, age) VALUES

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:44 -0500, Jerry Schwartz wrote: Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query =

Re: catch the error [OFF TOPIC]

2009-02-26 Thread Claudio Nanni
Gentlemen, my opinion is that this post is OFF TOPIC, let's don't wade into the PHP world here, let's keep this list clean and focused on MySQL. If the insert works from console and not from PHP probably is PHP related problem and there are thousands of lists on PHP. This is the most

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:56 -0500, PJ wrote: Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here is

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
Sorry, I should know better. -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, February 26, 2009 1:51 PM To: Jerry Schwartz Cc: 'PJ'; 'Gary W. Smith'; 'MySql'; php-gene...@lists.php.net Subject: RE: [PHP] RE: non-auto increment question On Thu,

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 14:15 -0500, PJ wrote: Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:56 -0500, PJ wrote: Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ,

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Gary W. Smith
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by

batch insert

2009-02-26 Thread wenzhu cui
In C API, I want to insert 1 sql. I must have one strSql= insert into tables hello id ,blob values(?,?),(?,?),(?,?)..。 then bind every pos with mysql_stmt_bind_param(). then to exec. In C API don't have batchexec。 if I can have strSQL = inset into tables hello id,blob