[PHP] Re: php-mysql problem
$sql = SELECT count(Email) as numEmails, Email FROM mena_guests WHERE Voted='yes' GROUP BY Email ORDER BY numEmails DESC LIMIT $startingID, $items_numbers_list; -- itoctopus - http://www.itoctopus.com Me2resh Lists [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php-mysql problem
$sql = SELECT count(Email) as numEmails, Email FROM mena_guests WHERE Voted='yes' GROUP BY Email ORDER BY numEmails DESC LIMIT $startingID, $items_numbers_list; I answered this morning, I don't know why it got deleted -- itoctopus - http://www.itoctopus.com Me2resh Lists [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php mysql problem
On Tue, May 2, 2006 7:05 am, 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. Change item_id 3 to 1. ... select id from board_papers where item_id = 3 ... $id3 = mysql_result($result); ... select id from board_papers where item_id = 1 ... $id1 = mysql_result($result); ... update board_papers set item_id = 1 where id = $id3 ... update board_papers set item_id = 3 where id = $id1 Delete an item: $item_id = 42; ... delete from board_papers where item_id = 42 ... update board_papers set item_id = item_id - 1 where item_id 42 It's up to you to actually add all the function calls and quotes and error-checking and make it work for variables instead of constants. -- 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] Re: php mysql problem
On Tue, May 2, 2006 7:22 am, chris smith wrote: On 5/2/06, Ross [EMAIL PROTECTED] 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. Why do you want to do that? There's no benefit in doing this.. actually it becomes a pain. You'd need to update not only this table but any field in other tables that references this one as well (and if you miss one, you have a completely useless database). No, we've got past that bit. Now he just wants user-definable ordering in sequence from 1 to N, using item_id as the user-modifiable field, and id as the auto_increment field. item_id is a HORRIBLE name for such a field, mind you... Call it rank or something, okay Ross? While you are at it, id is an awfully generic name for a field, really. I personally prefer: create table foo (foo_id int(11) auto_increment, ...); But, hey, a lot of folks go with just id on everything, and seem okay with that. [shrug] -- 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] Re: php mysql problem
On 5/3/06, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, May 2, 2006 7:22 am, chris smith wrote: On 5/2/06, Ross [EMAIL PROTECTED] 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. Why do you want to do that? There's no benefit in doing this.. actually it becomes a pain. You'd need to update not only this table but any field in other tables that references this one as well (and if you miss one, you have a completely useless database). No, we've got past that bit. I posted that answer yesterday... By the time I got back to the thread everyone had worked out that he wanted to use it for ordering results ;) While you are at it, id is an awfully generic name for a field, really. I personally prefer: create table foo (foo_id int(11) auto_increment, ...); But, hey, a lot of folks go with just id on everything, and seem okay with that. [shrug] Very true - would get rather confusing in link tables: create table news_cat (id int, id int); heh. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php mysql problem
Ross schrieb: 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 Why do you auto_increment them then? Normally it's very wrong to set back autoincremented values because you don't have any reference anymore. So if ID X is causing an error it could be Article X or Article Y or article Z. You don't know because the database is shifting it around. Add a second field called sort or something similiar and let it sort on that. Or give it Article Numbers or whatever. (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. update id = id +1 WHERE id X Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php mysql problem
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 ; Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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
Re: [PHP] Re: php mysql problem
On 5/2/06, Ross [EMAIL PROTECTED] 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. Why do you want to do that? There's no benefit in doing this.. actually it becomes a pain. You'd need to update not only this table but any field in other tables that references this one as well (and if you miss one, you have a completely useless database). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php mysql problem
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 ; Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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 Really can't imagine why you wanna do something like this. What's the use in reordering a database. It's just a database. you can sort it in any way you like.. gaps or not.. Sounds to me the sorting is only done on screen. This is pretty easy done with PHP not in the database itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php mysql problem
Exactly - I don't think you really understand how a relational database works. The ids are retained as they may relate to records in another table. Internal sorting order is of no relevance at the application level. I think you need to rethink your design a little. On 02/05/06, T.Lensselink [EMAIL PROTECTED] 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 ; Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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 Really can't imagine why you wanna do something like this. What's the use in reordering a database. It's just a database. you can sort it in any way you like.. gaps or not.. Sounds to me the sorting is only done on screen. This is pretty easy done with PHP not in the database itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!
Re: [PHP] mysql problem- I know it isn't strictly php
Ross wrote: Hi all, I am trying to create a table on the remote server but it never seems to work CREATE TABLE `sheet1` ( `id` int(10) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '', `fname` varchar(255) NOT NULL default '', `sname` varchar(255) default NULL, `job_title` varchar(255) default NULL, `organisation` varchar(255) default NULL, `email` varchar(255) default NULL, `street` varchar(255) default NULL, `city` varchar(255) default NULL, `postcode` varchar(255) default NULL, `office_tel` varchar(255) default NULL, `mobile` varchar(255) default NULL, `fax` varchar(255) default NULL, `web` varchar(255) default NULL, `add_info` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=303 ; There seems to be a problem with the last line (this is exported from my local server). I am just learning about mySql as I go so have no real clue about CHARSET and ENGINE (which I believe may be the problem) This is the error 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=303' at line 18 and this is what the manual says (not very helpful) a.. Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at line %d Any help will be appreciated. R. If you have phpMyAdmin installed, create the table there and then export the table structure - I have found this to be very reliable in the past. Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql problem- I know it isn't strictly php
[snip] 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=303' at line 18 and this is what the manual says (not very helpful) a.. Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at line %d Any help will be appreciated. [/snip] There is nothing PHP here, but you knew that when you pressed send. Really there are a lot of MySQL gurus on this list. There are a lot more on mysql@lists.mysql.com You're problem is likely related to the version of MySQL that you are running, perhaps it doesn't support CHARSET definitions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP, MySQL problem
Hi Add records with this code. ?php $name=isset($_POST['name']) ? $_POST['name'] :''; $address=isset($_POST['address']) ? $_POST['address'] :''; if (!empty($name)) { mysql_connect($server,$user,$pass) or die (Error conecting); mysql_select_db($dbnamn,$conection) or die (no db .$dbnamn); $query = insert into mytable (name, address) values ('$name', '$address'); $result = mysql_query ($query) or die(bad query); } ? html head/head body form action= method=post name input name=name address input name=address input type=submit value=add record /form /body/html Hope this helps. Jan Nicolai Elmqvist [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] 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
Re: [PHP] MySQL Problem
Felipe, I'm replying in spanish so you can understand better. El problema que tienes es que la variable $nueva_base esta vacia. Si deseas especificar el nombre con esa variable debes asignarle algun valor antes de llamarla, si lo que quieres es crear una base de datos que se llame nueva_base, debes quitarle el $. Ej. mysql_create_db(nueva_base). Espero te ayude. Oscar F.- Felipe R. wrote: Hi everyone, first, sorry to all if my english is so poor. second, i have the follow question: when i create a existing MySQL DBase, what happend?? how can i avoid this problem?? i attached my create_table code. Thanks for all html head titleCreación de una Base de Datos/title /head body h2 Creando Base de Datos/h2 ?php $connection = mysql_connect(localhost,ferios,ferios) or die (No se puede conectar a MySQL); if (!$connection) { die (No se puede conectar a MySQL); } if (mysql_create_db($nueva_base)) { print (nbspnbspnbspnbsp Base de Datos font color=\red\ size=\5\$nueva_base/font Creada Satisfactoriamente!!BRBR); $db_list = mysql_list_dbs($connection); $indice=0; while($row = mysql_fetch_array($db_list)){ $bases[$indice]=$row[0]; $indice++; } mysql_close($connection); echo nbspnbspnbspnbspB Las Bases de Datos Disponibles son: /BBR; for($aux = 0; $aux $indice; $aux++) { echo nbspnbspnbspnbspnbspnbspnbspnbsp $bases[$aux]BR; } }else{ print (Ërror Creando la Base de Datos: . mysql_error()); } ? font size=3 pVolver a a href=http://localhost/administrador.htm;Administrador de Bases de Datos/a/font font size=3 pVolver a a href=http://localhost/nueva_base.htm;Crear un Base de Datos/a/font /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL problem with RedHat 8
Hi Again, I already have it! (And it is the one from the distro) [daniel@p85 daniel]$ rpm -q php-mysql php-mysql-4.2.2-8.0.5 /daniel On Wed, 2003-01-15 at 02:19, Larry Brown wrote: You need the php-mysql rpm do rpm -q php-mysql Get the one from the distro Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Daniel Elenius [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 5:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] MySQL problem with RedHat 8 Yes, mysql.so is in /usr/lib/php4. The php.ini file has this in it: [daniel@p85 etc]$ grep mysql php.ini ;extension=php_mysql.dll extension=mysql.so mysql.allow_persistent = On mysql.max_persistent = -1 mysql.max_links = -1 ; Default port number for mysql_connect(). If unset, mysql_connect() will use ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the mysql.default_port = mysql.default_socket = ; Default host for mysql_connect() (doesn't apply in safe mode). mysql.default_host = ; Default user for mysql_connect() (doesn't apply in safe mode). mysql.default_user = ; Default password for mysql_connect() (doesn't apply in safe mode). ; *Any* user with PHP access can run 'echo cfg_get_var(mysql.default_password) mysql.default_password = /daniel On Tue, 2003-01-14 at 23:17, Joseph W. Goff wrote: Make sure that the shared module is in the correct directory. Check your php.ini file to make sure but it is most likely at /usr/lib/php4 make sure that you have mysql.so - Original Message - From: Daniel Elenius [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 3:58 PM Subject: [PHP] MySQL problem with RedHat 8 Hi! I'm trying to connect to my mysql database using something like mysql_connect( 'localhost', 'root', 'thepassword' ) or die ( 'Unable to connect to server.' ); But I get the error message: Fatal error: Call to undefined function: mysql_connect() in /home/daniel/public_html/index.php on line 21 I have: [root@p85 /]# rpm -qa |grep sql php-mysql-4.2.2-8.0.5 mysql-3.23.52-3 mysql-server-3.23.52-3 mysql-devel-3.23.52-3 and: [root@p85 /]# rpm -q php php-4.2.2-8.0.5 Someone mentioned these two settings in php.ini, which I tried with no success: register_globals = On short_open_tag = On phpinfo() says that php was compiled with '--with-mysql=shared,/usr' Can someone help me please? regards, -- Daniel Elenius [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel Elenius [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel Elenius [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL problem with RedHat 8
Make sure that the shared module is in the correct directory. Check your php.ini file to make sure but it is most likely at /usr/lib/php4 make sure that you have mysql.so - Original Message - From: Daniel Elenius [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 3:58 PM Subject: [PHP] MySQL problem with RedHat 8 Hi! I'm trying to connect to my mysql database using something like mysql_connect( 'localhost', 'root', 'thepassword' ) or die ( 'Unable to connect to server.' ); But I get the error message: Fatal error: Call to undefined function: mysql_connect() in /home/daniel/public_html/index.php on line 21 I have: [root@p85 /]# rpm -qa |grep sql php-mysql-4.2.2-8.0.5 mysql-3.23.52-3 mysql-server-3.23.52-3 mysql-devel-3.23.52-3 and: [root@p85 /]# rpm -q php php-4.2.2-8.0.5 Someone mentioned these two settings in php.ini, which I tried with no success: register_globals = On short_open_tag = On phpinfo() says that php was compiled with '--with-mysql=shared,/usr' Can someone help me please? regards, -- Daniel Elenius [EMAIL PROTECTED] -- 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] MySQL problem with RedHat 8
Yes, mysql.so is in /usr/lib/php4. The php.ini file has this in it: [daniel@p85 etc]$ grep mysql php.ini ;extension=php_mysql.dll extension=mysql.so mysql.allow_persistent = On mysql.max_persistent = -1 mysql.max_links = -1 ; Default port number for mysql_connect(). If unset, mysql_connect() will use ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the mysql.default_port = mysql.default_socket = ; Default host for mysql_connect() (doesn't apply in safe mode). mysql.default_host = ; Default user for mysql_connect() (doesn't apply in safe mode). mysql.default_user = ; Default password for mysql_connect() (doesn't apply in safe mode). ; *Any* user with PHP access can run 'echo cfg_get_var(mysql.default_password) mysql.default_password = /daniel On Tue, 2003-01-14 at 23:17, Joseph W. Goff wrote: Make sure that the shared module is in the correct directory. Check your php.ini file to make sure but it is most likely at /usr/lib/php4 make sure that you have mysql.so - Original Message - From: Daniel Elenius [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 3:58 PM Subject: [PHP] MySQL problem with RedHat 8 Hi! I'm trying to connect to my mysql database using something like mysql_connect( 'localhost', 'root', 'thepassword' ) or die ( 'Unable to connect to server.' ); But I get the error message: Fatal error: Call to undefined function: mysql_connect() in /home/daniel/public_html/index.php on line 21 I have: [root@p85 /]# rpm -qa |grep sql php-mysql-4.2.2-8.0.5 mysql-3.23.52-3 mysql-server-3.23.52-3 mysql-devel-3.23.52-3 and: [root@p85 /]# rpm -q php php-4.2.2-8.0.5 Someone mentioned these two settings in php.ini, which I tried with no success: register_globals = On short_open_tag = On phpinfo() says that php was compiled with '--with-mysql=shared,/usr' Can someone help me please? regards, -- Daniel Elenius [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel Elenius [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql problem
Look into the logs, they should be more verbose. How did you install the three. BB wrote: I seem to have a php-mysql problem on my new Sun Qube3 (RH Linux). php works fine, mysql works fine, apache works fine, only the combination of the three seems troublesome. php does not recognize commands like mysql_connect() when trying to start phpMyAdmin I get: cannot load MySQL extension In my php.ini extension_dir is set correctly and I un-commented extension=mysql.so What more is there I could try? Thank you. Bert Bulder, Amsterdam NL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL Problem with PHP
INSERT INTO `contracts` (`key`, `content`) VALUES (1,'blah blah blah character 39 is a single speach mark '+CHAR(39)+' blah blah blah') That's because you are adding strings together, not concatenating them (this isn't javascript!) Use CONCAT() in MySQL to join strings together. mysql select 'this'+char(39)+'that'; ++ | 'this'+char(39)+'that' | ++ | 0 | ++ 1 row in set (0.03 sec) mysql select concat('this',char(39),'that'); ++ | concat('this',char(39),'that') | ++ | this'that | ++ 1 row in set (0.01 sec) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Problem with PHP
I understand about the concat function, but that doesn't really fit into my scheme of things I run all text for the web through a function SafeSQL so that values from the web don't make SQL error or potential hacks occur. All SafeSQL was doing (for mssql, access and just about any other db) was $text = preg_replace(/\'/,' + CHAR(39) + ',$text) so when SQL added the rows with a value of 0 instead of the string I was baffled. Shame mysql doesn't support inline concatenation John Holmes [EMAIL PROTECTED] wrote in message 000701c21d14$fc054370$b402a8c0@mango">news:000701c21d14$fc054370$b402a8c0@mango... INSERT INTO `contracts` (`key`, `content`) VALUES (1,'blah blah blah character 39 is a single speach mark '+CHAR(39)+' blah blah blah') That's because you are adding strings together, not concatenating them (this isn't javascript!) Use CONCAT() in MySQL to join strings together. mysql select 'this'+char(39)+'that'; ++ | 'this'+char(39)+'that' | ++ | 0 | ++ 1 row in set (0.03 sec) mysql select concat('this',char(39),'that'); ++ | concat('this',char(39),'that') | ++ | this'that | ++ 1 row in set (0.01 sec) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL problem
Here's the example from the PHP manual: The tutorial here are very helpfull: http://www.melonfire.com/community/columns/trog/ -- David ?php // Connecting, selecting database $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die(Could not connect); print Connected successfully; mysql_select_db(my_database) or die(Could not select database); // Performing SQL query $query = SELECT * FROM my_table; $result = mysql_query($query) or die(Query failed); // Printing results in HTML print table\n; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print \ttr\n; foreach ($line as $col_value) { print \t\ttd$col_value/td\n; } print \t/tr\n; } print /table\n; // Closing connection mysql_close($link); ? Hello, I am extremely new to MySQL and have never managed to get working smoothly with PHP before. I am trying really hard to understand how to work it, and am almost there. I have a problem which I do not know how to resolve and was wondering if anybody could help me. I have no idea what is wrong with the code and why I am getting the error message; Warning: Supplied argument is not a valid MySQL result resource in C:\apache\htdocs\sams\chapter10\results.php on line 47 I am currently using a book to aid me with MySQL, and this is an example from the book. It does not seem to work and I have no idea what I may have done wrong to obtain this warning. I have changed my login and password to question marks. ? if (!$searchtype || !$searchterm) { echo You have not entered search details. Please go back and try again.; exit; } $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); @ $db = mysql_pconnect(mesh, bookorama, bookorama123); if (!$db) { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(booktest); $query = select * from booktest where .$searchtype. like '%.$searchterm.%'; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo pstrong.($i+1).. Title: ; echo stripslashes($row[title]); echo /strongbrAuthor: ; echo stripslashes($row[author]); echo brISBN: ; echo stripslashes($row[isbn]); echo brPrice: ; echo stripslashes($row[price]); echo /p; } ? The problem seems to be around the lines of code; $result = mysql_query($query); $num_results = mysql_num_rows($result); Any assistance is appreciated. Yours, GF. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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 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] MySQL problem
Hiya, Thanks for the quick reply. I used the PHP manual example and it connects to the database successfully but cannot select the database. I'm not sure why this is? I've looked hard at it and I cannot see where I have gone wrong. Thanks. GF. - Original Message - From: David Jackson To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 31, 2001 1:48 AM Subject: Re: [PHP] MySQL problem Here's the example from the PHP manual: The tutorial here are very helpfull: http://www.melonfire.com/community/columns/trog/ -- David ?php // Connecting, selecting database $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die(Could not connect); print Connected successfully; mysql_select_db(my_database) or die(Could not select database); // Performing SQL query $query = SELECT * FROM my_table; $result = mysql_query($query) or die(Query failed); // Printing results in HTML print table\n; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print \ttr\n; foreach ($line as $col_value) { print \t\ttd$col_value/td\n; } print \t/tr\n; } print /table\n; // Closing connection mysql_close($link); ? Hello, I am extremely new to MySQL and have never managed to get working smoothly with PHP before. I am trying really hard to understand how to work it, and am almost there. I have a problem which I do not know how to resolve and was wondering if anybody could help me. I have no idea what is wrong with the code and why I am getting the error message; Warning: Supplied argument is not a valid MySQL result resource in C:\apache\htdocs\sams\chapter10\results.php on line 47 I am currently using a book to aid me with MySQL, and this is an example from the book. It does not seem to work and I have no idea what I may have done wrong to obtain this warning. I have changed my login and password to question marks. ? if (!$searchtype || !$searchterm) { echo You have not entered search details. Please go back and try again.; exit; } $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); @ $db = mysql_pconnect(mesh, bookorama, bookorama123); if (!$db) { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(booktest); $query = select * from booktest where .$searchtype. like '%.$searchterm.%'; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo pstrong.($i+1).. Title: ; echo stripslashes($row[title]); echo /strongbrAuthor: ; echo stripslashes($row[author]); echo brISBN: ; echo stripslashes($row[isbn]); echo brPrice: ; echo stripslashes($row[price]); echo /p; } ? The problem seems to be around the lines of code; $result = mysql_query($query); $num_results = mysql_num_rows($result); Any assistance is appreciated. Yours, GF. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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] MySQL problem
* GoodFella ([EMAIL PROTECTED]) [Dec 30. 2001 21:10]: Thanks for the quick reply. I used the PHP manual example and it connects to the database successfully but cannot select the database. So you are using this line: mysql_select_db(booktest); Correct? What does the server say in return? What is the error message? -- Brian Clark | Avoiding the general public since 1805! Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8 You can't put a bag over someone's personality. -- 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] MySQL problem
I almost forgot add a or mysql_error() for each line like this: ?php // database connect script $dbhostname = localhost; $dbuser = db_user_name; $dbpasswd = db_password; $dbname= db_name; $link = mysql_connect($dbhostname, $dbuser, $dbpasswd) echo mysql_error(); mysql_select_db($dbname) echo mysql_error(); ? This will return human readable error messges Can you onto mysql database from command. mysql -u root -p mysql or mysql -u root mysql # A root password isn't usally get during install. if so: select user,host,password from user; then: select user,host,db from db; My quesss you don't have any permission for the databases or to connect to local host. If this is correct do: GRANT ALL on db_name.* TO you@local host idendified by 'your_password'; Hiya, Thanks for the quick reply. I used the PHP manual example and it connects to the database successfully but cannot select the database. I'm not sure why this is? I've looked hard at it and I cannot see where I have gone wrong. Thanks. GF. - Original Message - From: David Jackson To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 31, 2001 1:48 AM Subject: Re: [PHP] MySQL problem Here's the example from the PHP manual: The tutorial here are very helpfull: http://www.melonfire.com/community/columns/trog/ -- David ?php // Connecting, selecting database $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die(Could not connect); print Connected successfully; mysql_select_db(my_database) or die(Could not select database); // Performing SQL query $query = SELECT * FROM my_table; $result = mysql_query($query) or die(Query failed); // Printing results in HTML print table\n; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print \ttr\n; foreach ($line as $col_value) { print \t\ttd$col_value/td\n; } print \t/tr\n; } print /table\n; // Closing connection mysql_close($link); ? Hello, I am extremely new to MySQL and have never managed to get working smoothly with PHP before. I am trying really hard to understand how to work it, and am almost there. I have a problem which I do not know how to resolve and was wondering if anybody could help me. I have no idea what is wrong with the code and why I am getting the error message; Warning: Supplied argument is not a valid MySQL result resource in C:\apache\htdocs\sams\chapter10\results.php on line 47 I am currently using a book to aid me with MySQL, and this is an example from the book. It does not seem to work and I have no idea what I may have done wrong to obtain this warning. I have changed my login and password to question marks. ? if (!$searchtype || !$searchterm) { echo You have not entered search details. Please go back and try again.; exit; } $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); @ $db = mysql_pconnect(mesh, bookorama, bookorama123); if (!$db) { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(booktest); $query = select * from booktest where .$searchtype. like '%.$searchterm.%'; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo pstrong.($i+1).. Title: ; echo stripslashes($row[title]); echo /strongbrAuthor: ; echo stripslashes($row[author]); echo brISBN: ; echo stripslashes($row[isbn]); echo brPrice: ; echo stripslashes($row[price]); echo /p; } ? The problem seems to be around the lines of code; $result = mysql_query($query); $num_results = mysql_num_rows($result); Any assistance is appreciated. Yours, GF. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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 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] MySQL problem
Thanks so much guys, It was my user permissions all along. Funnily enough the book gives you guidelines on how to set them up, and sets up a fair few... but for some reason they selected the wrong user to use. Thanks very much for your help David and Brian- much appreciated. Yours, GF - Original Message - From: David Jackson To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Monday, December 31, 2001 2:41 AM Subject: Re: [PHP] MySQL problem I almost forgot add a or mysql_error() for each line like this: ?php // database connect script $dbhostname = localhost; $dbuser = db_user_name; $dbpasswd = db_password; $dbname= db_name; $link = mysql_connect($dbhostname, $dbuser, $dbpasswd) echo mysql_error(); mysql_select_db($dbname) echo mysql_error(); ? This will return human readable error messges Can you onto mysql database from command. mysql -u root -p mysql or mysql -u root mysql # A root password isn't usally get during install. if so: select user,host,password from user; then: select user,host,db from db; My quesss you don't have any permission for the databases or to connect to local host. If this is correct do: GRANT ALL on db_name.* TO you@local host idendified by 'your_password'; Hiya, Thanks for the quick reply. I used the PHP manual example and it connects to the database successfully but cannot select the database. I'm not sure why this is? I've looked hard at it and I cannot see where I have gone wrong. Thanks. GF. - Original Message - From: David Jackson To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 31, 2001 1:48 AM Subject: Re: [PHP] MySQL problem Here's the example from the PHP manual: The tutorial here are very helpfull: http://www.melonfire.com/community/columns/trog/ -- David ?php // Connecting, selecting database $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die(Could not connect); print Connected successfully; mysql_select_db(my_database) or die(Could not select database); // Performing SQL query $query = SELECT * FROM my_table; $result = mysql_query($query) or die(Query failed); // Printing results in HTML print table\n; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print \ttr\n; foreach ($line as $col_value) { print \t\ttd$col_value/td\n; } print \t/tr\n; } print /table\n; // Closing connection mysql_close($link); ? Hello, I am extremely new to MySQL and have never managed to get working smoothly with PHP before. I am trying really hard to understand how to work it, and am almost there. I have a problem which I do not know how to resolve and was wondering if anybody could help me. I have no idea what is wrong with the code and why I am getting the error message; Warning: Supplied argument is not a valid MySQL result resource in C:\apache\htdocs\sams\chapter10\results.php on line 47 I am currently using a book to aid me with MySQL, and this is an example from the book. It does not seem to work and I have no idea what I may have done wrong to obtain this warning. I have changed my login and password to question marks. ? if (!$searchtype || !$searchterm) { echo You have not entered search details. Please go back and try again.; exit; } $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); @ $db = mysql_pconnect(mesh, bookorama, bookorama123); if (!$db) { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(booktest); $query = select * from booktest where .$searchtype. like '%.$searchterm.%'; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo pstrong.($i+1).. Title: ; echo stripslashes($row[title]); echo /strongbrAuthor: ; echo stripslashes($row[author]); echo brISBN: ; echo stripslashes($row[isbn]); echo brPrice: ; echo stripslashes($row[price]); echo /p; } ? The problem seems to be around the lines of code; $result = mysql_query($query); $num_results = mysql_num_rows($result); Any assistance is appreciated. Yours, GF
RE: [PHP] mySQL problem
Try this $Query = "SELECT UCASE(Company) as company, Icons, ID, LogoD FROM feComps"; List ( $company, $icons, etc ) = mysql_fetch_row( ); -Original Message- From: Niklas Lampn [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 10:22 AM To: Php-General Subject: [PHP] mySQL problem I'm having a wierd problem with mySQL query. $Query = "SELECT UCASE(Company), Icons, ID, LogoD FROM feComps"; returns right amount of rows, but field Company is empty. $Query = "SELECT Company, Icons, ID, LogoD FROM feComps."; works fine. First query works great when I run it in shell. What could cause this? Niklas -- 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] mySQL problem
Try this $Query = "SELECT UCASE(Company) as company, Icons, ID, LogoD FROM feComps"; List ( $company, $icons, etc ) = mysql_fetch_row( ); -Original Message- From: Niklas Lampn [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 10:22 AM To: Php-General Subject: [PHP] mySQL problem I'm having a wierd problem with mySQL query. $Query = "SELECT UCASE(Company), Icons, ID, LogoD FROM feComps"; returns right amount of rows, but field Company is empty. $Query = "SELECT Company, Icons, ID, LogoD FROM feComps."; works fine. First query works great when I run it in shell. What could cause this? Niklas -- 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] mySQL problem
SELECT UCASE(Company) AS Company works great, thanks! Niklas -Original Message- From: Dimitris Kossikidis [mailto:[EMAIL PROTECTED]] Sent: 2. marraskuuta 2001 11:11 To: 'Niklas Lamp¨¦n' Cc: PHP General Subject: RE: [PHP] mySQL problem Try this $Query = SELECT UCASE(Company) as company, Icons, ID, LogoD FROM feComps; List ( $company, $icons, etc ) = mysql_fetch_row( ); -Original Message- From: Niklas Lamp¦Én [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 10:22 AM To: Php-General Subject: [PHP] mySQL problem I'm having a wierd problem with mySQL query. $Query = SELECT UCASE(Company), Icons, ID, LogoD FROM feComps; returns right amount of rows, but field Company is empty. $Query = SELECT Company, Icons, ID, LogoD FROM feComps.; works fine. First query works great when I run it in shell. What could cause this? Niklas -- 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] mySQL problem
The issue here is that you aren't getting an index of Company from that query. It is probably stored under the index of UCASE(Company). Try: $Query = SELECT UCASE(Company) as ucCompany, Icons, ID,...; Then the ucCompany field will contain your capitalized company data. Jon -Original Message- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 2:22 AM To: Php-General Subject: [PHP] mySQL problem I'm having a wierd problem with mySQL query. $Query = SELECT UCASE(Company), Icons, ID, LogoD FROM feComps; returns right amount of rows, but field Company is empty. $Query = SELECT Company, Icons, ID, LogoD FROM feComps.; works fine. First query works great when I run it in shell. What could cause this? Niklas -- 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] MySQL problem
On 04-Jul-01 Simon Kimber wrote: Hi All, Does anyone know if this can be done with one query? I have to create a chart based on info in two tables that are four tables apart. Here are the relevant tables and just the most relevant fields... accident_report - ID - weekending (this is a -MM-DD format date) - (and others) accident_data - ID - accident_report_id - (and others) accident_cause (a lookup table) - ID - accident_data_id - cause_id cause (a list of possible causes of accidents ie. falling object or electric shock - ID - Description I need to list all the causes with the number of times each has occurred, even if it's zero times... they don't need to be listed in any particular order... select cause.ID, count(*) as cnt from ... WHERE ... group by cause.ID; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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] MySQL problem
Sorry!!! I'm stupid! I forgot to mention that the list of causes has to be for a specified accident_report.weekending Cheers Simon -Original Message- From: Don Read [mailto:[EMAIL PROTECTED]] Sent: 04 July 2001 23:21 To: Simon Kimber Cc: [EMAIL PROTECTED] Subject: RE: [PHP] MySQL problem On 04-Jul-01 Simon Kimber wrote: Hi All, Does anyone know if this can be done with one query? I have to create a chart based on info in two tables that are four tables apart. Here are the relevant tables and just the most relevant fields... accident_report - ID - weekending (this is a -MM-DD format date) - (and others) accident_data - ID - accident_report_id - (and others) accident_cause (a lookup table) - ID - accident_data_id - cause_id cause (a list of possible causes of accidents ie. falling object or electric shock - ID - Description I need to list all the causes with the number of times each has occurred, even if it's zero times... they don't need to be listed in any particular order... select cause.ID, count(*) as cnt from ... WHERE ... group by cause.ID; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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] MySQL problem...
Generally spoken, echo the SQL-Statement, and paste it in your local MySql Client (e.g. MySql-Font). These Frontends give you a better error, and you´ll find the problem in seconds. (hope so) Peter Houchin [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... some code would be nice to have a look at :) Other than that, check table names, database names, also your result lines, I've found i get that error by not calling a result or calling the incorrect table/database Peter -Original Message- From: Brian Rue [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL problem... MySQL doesn't like me Sometimes, my pages that connect to the database get the error Warning: Supplied argument is not a valid MySQL result resource... repeated over and over again (something like 1000 times...) What's causing this error? Obviously, PHP isn't getting a result back from MySQL... and it keeps trying to get it. Any help? Thanks, Brian Rue -- 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] MySQL problem...
some code would be nice to have a look at :) Other than that, check table names, database names, also your result lines, I've found i get that error by not calling a result or calling the incorrect table/database Peter -Original Message- From: Brian Rue [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL problem... MySQL doesn't like me Sometimes, my pages that connect to the database get the error Warning: Supplied argument is not a valid MySQL result resource... repeated over and over again (something like 1000 times...) What's causing this error? Obviously, PHP isn't getting a result back from MySQL... and it keeps trying to get it. Any help? Thanks, Brian Rue -- 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] MySQL problem...
Here's all the code that uses MySQL... $db = mysql_connect(localhost,user,pass); mysql_select_db(db,$db); $gmdquery=SELECT * FROM game_of_the_day; $the_info = mysql_query($gmdquery,$db); while ($myrow = mysql_fetch_row($the_info)) { (get info from the result) } ... (decide whether or not to conduct the following operation) if (true) { $query=SELECT id FROM games WHERE rating = 7; $result=mysql_query($query,$db); $numgames=mysql_num_rows($result); $z=0; while ($row=mysql_fetch_row($result)){ $gotd_cand[$z]=$row[0]; $z++; } (at this point, i randomly select 2 games from the db) $query=SELECT genre,number FROM games WHERE id=$game1_to_get; $gameinfo=mysql_query($query,$db); while($row=mysql_fetch_row($gameinfo)){ (use the result) } (do the same thing as before, but for the second game) } (update the db) $query=DELETE FROM game_of_the_day; $result=mysql_query($query,$db); $query=INSERT INTO game_of_the_day VALUES ('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu mber); $result=mysql_query($query,$db); } Keep in mind that this only happens some of the time... sometimes it works, and sometimes it just doesn't. Today, I noticed that it stored the first game into the db twice (the code doesn't allow for the same game to be selected twice...) Thanks for your time Peter Houchin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... some code would be nice to have a look at :) Other than that, check table names, database names, also your result lines, I've found i get that error by not calling a result or calling the incorrect table/database Peter -Original Message- From: Brian Rue [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL problem... MySQL doesn't like me Sometimes, my pages that connect to the database get the error Warning: Supplied argument is not a valid MySQL result resource... repeated over and over again (something like 1000 times...) What's causing this error? Obviously, PHP isn't getting a result back from MySQL... and it keeps trying to get it. Any help? Thanks, Brian Rue -- 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 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] MySQL problem...
I think here's your problem: $query=INSERT INTO game_of_the_day VALUES ('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu mber); should look like : $query= INSERT INTO game_of_the_day (ID, curr_yday, gameone_genre, gameone_number, gametwo_genre, gametwo_number) VALUES ('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu mber) ; try it. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Brian Rue [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 12:24 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] MySQL problem... Here's all the code that uses MySQL... $db = mysql_connect(localhost,user,pass); mysql_select_db(db,$db); $gmdquery=SELECT * FROM game_of_the_day; $the_info = mysql_query($gmdquery,$db); while ($myrow = mysql_fetch_row($the_info)) { (get info from the result) } ... (decide whether or not to conduct the following operation) if (true) { $query=SELECT id FROM games WHERE rating = 7; $result=mysql_query($query,$db); $numgames=mysql_num_rows($result); $z=0; while ($row=mysql_fetch_row($result)){ $gotd_cand[$z]=$row[0]; $z++; } (at this point, i randomly select 2 games from the db) $query=SELECT genre,number FROM games WHERE id=$game1_to_get; $gameinfo=mysql_query($query,$db); while($row=mysql_fetch_row($gameinfo)){ (use the result) } (do the same thing as before, but for the second game) } (update the db) $query=DELETE FROM game_of_the_day; $result=mysql_query($query,$db); $query=INSERT INTO game_of_the_day VALUES ('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu mber); $result=mysql_query($query,$db); } Keep in mind that this only happens some of the time... sometimes it works, and sometimes it just doesn't. Today, I noticed that it stored the first game into the db twice (the code doesn't allow for the same game to be selected twice...) Thanks for your time Peter Houchin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... some code would be nice to have a look at :) Other than that, check table names, database names, also your result lines, I've found i get that error by not calling a result or calling the incorrect table/database Peter -Original Message- From: Brian Rue [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL problem... MySQL doesn't like me Sometimes, my pages that connect to the database get the error Warning: Supplied argument is not a valid MySQL result resource... repeated over and over again (something like 1000 times...) What's causing this error? Obviously, PHP isn't getting a result back from MySQL... and it keeps trying to get it. Any help? Thanks, Brian Rue -- 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 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 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] MySQL problem - stumped
At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote: You are using in your statement ... should be "AND" . The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Line 147, is the last line in the above snippet. I cleared out the path name for security, no offense intended :) Now, I KNOW that the db_connect() function is not the problem, as I use it in many other places in this script with no errors. What am I missing? - John Vanderbeck - Admin, GameDesign -- 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] ## # Rick St Jean, # [EMAIL PROTECTED] # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ## -- 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] MySQL problem - stumped
At 19:58 10.03.2001, John Vanderbeck said: [snip] $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; [snip] Try "AND" instead of "", this should work as intended... ...ebird O Ernest E. Vogelsinger (\)http://www.1-at-web.at/ ^ ICQ# 13394035 -- 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] MySQL problem - stumped
Ok, Well I got 3 replies saying that my use of is incorrect, and that I should use AND. This confused me for 2 reasons. First, is that I use in all my other SELECT queries, with no problems. In fact, the MySQL docs, show the use of , not AND. Secondly, because if I had a bad query, it should have given me some sort of error when I output mysql_error(). No? However, I did of course try changing it to AND instead of . But the problem remains. Same error. Any other ideas? - John Vanderbeck - Admin, GameDesign -Original Message- From: Rick St Jean [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 2:09 PM To: PHP User Group Subject: Re: [PHP] MySQL problem - stumped At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote: You are using in your statement ... should be "AND" . The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Line 147, is the last line in the above snippet. I cleared out the path name for security, no offense intended :) Now, I KNOW that the db_connect() function is not the problem, as I use it in many other places in this script with no errors. What am I missing? - John Vanderbeck - Admin, GameDesign -- 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] ## # Rick St Jean, # [EMAIL PROTECTED] # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ## -- 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 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] MySQL problem - stumped
Well, PHP seems to think that $link is not working, so your db_connect() is in fact, the problem. You say you use db_connect several times in this script without problem - why do you keep connecting to the same database repeatedly in the same script - one connection will do for all your queries. HTH, Julian on 3/10/01 12:11 PM, John Vanderbeck at [EMAIL PROTECTED] wrote: Ok, Well I got 3 replies saying that my use of is incorrect, and that I should use AND. This confused me for 2 reasons. First, is that I use in all my other SELECT queries, with no problems. In fact, the MySQL docs, show the use of , not AND. Secondly, because if I had a bad query, it should have given me some sort of error when I output mysql_error(). No? However, I did of course try changing it to AND instead of . But the problem remains. Same error. Any other ideas? - John Vanderbeck - Admin, GameDesign -Original Message- From: Rick St Jean [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 2:09 PM To: PHP User Group Subject: Re: [PHP] MySQL problem - stumped At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote: You are using in your statement ... should be "AND" . The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Line 147, is the last line in the above snippet. I cleared out the path name for security, no offense intended :) Now, I KNOW that the db_connect() function is not the problem, as I use it in many other places in this script with no errors. What am I missing? - John Vanderbeck - Admin, GameDesign -- Julian Wood Learning Technologies and Digital Media University of Calgary -- 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] MySQL problem - stumped
The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Hi OK my thoughts, no disrespect intended. Is the table Users and not users? Are all the column names correct and are they really in this tables?? also try $result = mysql_query($query, $link) or die ($mysql_error()) to see what output mysql is giving as to why the query failed. As I say no disrespect but you need to go back and try to unsderstand why it is failing M@ -- 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] MySQL problem - stumped
On Saturday 10 March 2001 19:58, you wrote: The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Line 147, is the last line in the above snippet. I cleared out the path name for security, no offense intended :) This one? $rows = mysql_affected_rows($result); Try $rows = mysql_affected_rows($link); -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. - Edsger W. Dijkstra -- 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] MySQL problem - stumped
I do'nt connect multiple times..its one large script that handles different tasks based on the settings of control vars. I just like to keep it all together. The $link has to be valid, or it would be erroring out on the mysql_query() call. Which it is not, and it reports no errors with that call. - John Vanderbeck - Admin, GameDesign -Original Message- From: Julian Wood [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 2:28 PM To: John Vanderbeck; PHP User Group Subject: Re: [PHP] MySQL problem - stumped Well, PHP seems to think that $link is not working, so your db_connect() is in fact, the problem. You say you use db_connect several times in this script without problem - why do you keep connecting to the same database repeatedly in the same script - one connection will do for all your queries. HTH, Julian on 3/10/01 12:11 PM, John Vanderbeck at [EMAIL PROTECTED] wrote: Ok, Well I got 3 replies saying that my use of is incorrect, and that I should use AND. This confused me for 2 reasons. First, is that I use in all my other SELECT queries, with no problems. In fact, the MySQL docs, show the use of , not AND. Secondly, because if I had a bad query, it should have given me some sort of error when I output mysql_error(). No? However, I did of course try changing it to AND instead of . But the problem remains. Same error. Any other ideas? - John Vanderbeck - Admin, GameDesign -Original Message- From: Rick St Jean [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 2:09 PM To: PHP User Group Subject: Re: [PHP] MySQL problem - stumped At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote: You are using in your statement ... should be "AND" . The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Line 147, is the last line in the above snippet. I cleared out the path name for security, no offense intended :) Now, I KNOW that the db_connect() function is not the problem, as I use it in many other places in this script with no errors. What am I missing? - John Vanderbeck - Admin, GameDesign -- Julian Wood Learning Technologies and Digital Media University of Calgary -- 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] MySQL problem - stumped
Grr.. Thank You! God I feel like the idiot now. Why didn't I see that? Heck why didn't anyone else see it either :) I'm so used to using $rows = mysql_num_rows($result), that I just did the same thing here. But your right, the docs say THIS one takes a LINK and not a RESULT identifier. Grr.. Thanks again. Your a deadline saver :) - John Vanderbeck - Admin, GameDesign -Original Message- From: Christian Reiniger [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 2:32 PM To: PHP User Group Subject: Re: [PHP] MySQL problem - stumped On Saturday 10 March 2001 19:58, you wrote: The following code is giving an me problems, I can't figure it out to save my soul. The last line gives: Here is the code: $link = db_connect(); $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname' WHERE username='$user' password='$password'"; $result = mysql_query($query, $link); $err = mysql_error(); echo "Errors:".$err; $rows = mysql_affected_rows($result); And here is the output: Errors: Warning: Supplied argument is not a valid MySQL-Link resource in //*//**..***/db.php on line 147 Line 147, is the last line in the above snippet. I cleared out the path name for security, no offense intended :) This one? $rows = mysql_affected_rows($result); Try $rows = mysql_affected_rows($link); -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. - Edsger W. Dijkstra -- 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 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] mysql problem
On Tue, 20 Feb 2001 10:57, Josh G wrote: Hi, sorry to post this here, but it's driving me crazy. On my local machine, the following works no furys: create table category (category_id integer primary key auto_increment,name varchar(255) ); But on the production machine, I get: ERROR 1064: parse error near 'auto_increment,name varchar(255) )' at line 1 Any idea why It's driving me nuts.. Gfunk - http://www.gfunk007.com/ Is the version of Mysql on the production box an older one? autoincrement is comparatively new, I think. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- 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] mysql problem
Nope, I've been using autoincrement on that box for a year or so. It's not a copy/paste thing, cause I'm getting it when I type the lines in by hand, too... Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "David Robley" [EMAIL PROTECTED] To: "Josh G" [EMAIL PROTECTED]; "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:41 AM Subject: Re: [PHP] mysql problem On Tue, 20 Feb 2001 10:57, Josh G wrote: Hi, sorry to post this here, but it's driving me crazy. On my local machine, the following works no furys: create table category (category_id integer primary key auto_increment,name varchar(255) ); But on the production machine, I get: ERROR 1064: parse error near 'auto_increment,name varchar(255) )' at line 1 Any idea why It's driving me nuts.. Gfunk - http://www.gfunk007.com/ Is the version of Mysql on the production box an older one? autoincrement is comparatively new, I think. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- 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 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] mysql problem
Ok, I've fixed the problem, it seems there's some major differences between the linux / win32 ports of the client. instead of blah integer primary key auto_increment which works on windows, I used blah integer not null auto_increment primary key and now it works... I love computers, I really do. Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "Josh G" [EMAIL PROTECTED] To: "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:42 AM Subject: Re: [PHP] mysql problem Nope, I've been using autoincrement on that box for a year or so. It's not a copy/paste thing, cause I'm getting it when I type the lines in by hand, too... Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "David Robley" [EMAIL PROTECTED] To: "Josh G" [EMAIL PROTECTED]; "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:41 AM Subject: Re: [PHP] mysql problem On Tue, 20 Feb 2001 10:57, Josh G wrote: Hi, sorry to post this here, but it's driving me crazy. On my local machine, the following works no furys: create table category (category_id integer primary key auto_increment,name varchar(255) ); But on the production machine, I get: ERROR 1064: parse error near 'auto_increment,name varchar(255) )' at line 1 Any idea why It's driving me nuts.. Gfunk - http://www.gfunk007.com/ Is the version of Mysql on the production box an older one? autoincrement is comparatively new, I think. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- 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 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 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] mysql problem
ahhh... yes... :) the linux version is much stricter when it comes to table definitions... i had the same problem trying to declare an INDEX for my table too for linux, any key that you use as an INDEX on a table must be declared NOT NULL (whereas the win32 port doesnt seem to care very much)... for future reference, i reccomend trying out your SQL code in the MySQL monitor (the command line utility that comes with the server)... generally the error messages are *MUCH* more helpful than the ones i get via PHP -Original Message- From: Josh G [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 17:00 To: PHP User Group Subject: Re: [PHP] mysql problem Ok, I've fixed the problem, it seems there's some major differences between the linux / win32 ports of the client. instead of blah integer primary key auto_increment which works on windows, I used blah integer not null auto_increment primary key and now it works... I love computers, I really do. Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "Josh G" [EMAIL PROTECTED] To: "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:42 AM Subject: Re: [PHP] mysql problem Nope, I've been using autoincrement on that box for a year or so. It's not a copy/paste thing, cause I'm getting it when I type the lines in by hand, too... Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "David Robley" [EMAIL PROTECTED] To: "Josh G" [EMAIL PROTECTED]; "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:41 AM Subject: Re: [PHP] mysql problem On Tue, 20 Feb 2001 10:57, Josh G wrote: Hi, sorry to post this here, but it's driving me crazy. On my local machine, the following works no furys: create table category (category_id integer primary key auto_increment,name varchar(255) ); But on the production machine, I get: ERROR 1064: parse error near 'auto_increment,name varchar(255) )' at line 1 Any idea why It's driving me nuts.. Gfunk - http://www.gfunk007.com/ Is the version of Mysql on the production box an older one? autoincrement is comparatively new, I think. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- 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 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 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 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] mysql problem
I think if you echo the error (echo mysql_error();) you will see the exact error you would get if connected directly to the db. You can do something like: $result = @mysql_query($sql_query); // hide any errors If (!$result) { echo "Error: " . Mysql_error() . "BR"; } On 2/20/01 2:57 AM this was written: ahhh... yes... :) the linux version is much stricter when it comes to table definitions... i had the same problem trying to declare an INDEX for my table too for linux, any key that you use as an INDEX on a table must be declared NOT NULL (whereas the win32 port doesnt seem to care very much)... for future reference, i reccomend trying out your SQL code in the MySQL monitor (the command line utility that comes with the server)... generally the error messages are *MUCH* more helpful than the ones i get via PHP -- Thomas Deliduka IT Manager - New Eve Media The Solution To Your Internet Angst http://www.neweve.com/ -- 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]