Re: [PHP] mysql error
Hi Grega, Probably you wanna define a primary key, if so, then change from "uniqueid" to "primary key". 2011/5/6 Curtis Maurand : > > > > engine= > > --C > > Grega Leskovšek wrote: >> Can smbd please look at this sentence - I got an error and do > not >> know how to fix it - I am still very unfamiliar with > MYSQL: >> >> CREATE TABLE log ( idlog int auto_increment > not null, imepriimek >> varchar(50), clock timestamp, action > varchar(30), onfile >> varchar(100), filesize float(6,2), > uniqueid(idlog) ); >> >> ERROR 1064 (42000): 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 > '(idlog) )' at line 1 >> >> -- When the sun rises I receive > and when it sets I forgive -> >> > http://moj.skavt.net/gleskovs/ >> Always in Heart, Grega > LeskovĹĄek >> >> -- >> 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 error
engine= --C Grega Leskov¹ek wrote: > Can smbd please look at this sentence - I got an error and do not > know how to fix it - I am still very unfamiliar with MYSQL: > > CREATE TABLE log ( idlog int auto_increment not null, imepriimek > varchar(50), clock timestamp, action varchar(30), onfile > varchar(100), filesize float(6,2), uniqueid(idlog) ); > > ERROR 1064 (42000): 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 '(idlog) )' at line 1 > > -- When the sun rises I receive and when it sets I forgive -> > http://moj.skavt.net/gleskovs/ > Always in Heart, Grega LeskovÅ¡ek > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] mysql error
On Thu, May 5, 2011 at 10:29, Grega Leskovšek wrote: > Can smbd please look at this sentence - I got an error and do not > know how to fix it - I am still very unfamiliar with MYSQL: > > CREATE TABLE log ( idlog int auto_increment not null, imepriimek > varchar(50), clock timestamp, action varchar(30), onfile > varchar(100), filesize float(6,2), uniqueid(idlog) ); > > ERROR 1064 (42000): 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 '(idlog) )' at line 1 This is by no means a PHP question, and should not be asked on the PHP General mailing list. Please ask questions in the appropriate place; for this, the MySQL General list is the correct forum, and they've been CC'd. In the future, if it relates to a PHP database issue, you may want to use the PHP Database mailing list, also CC'd. This not only means you'll get more on-target help faster, but also helps in archiving data in the proper location for future searchers. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
Hello Grega, What do you mean by uniqueid(idlog)? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Grega Leskovšek To: php-general Date created: , 5:29:44 PM Subject: [PHP] mysql error Can smbd please look at this sentence - I got an error and do not know how to fix it - I am still very unfamiliar with MYSQL: CREATE TABLE log ( idlog int auto_increment not null, imepriimek varchar(50), clock timestamp, action varchar(30), onfile varchar(100), filesize float(6,2), uniqueid(idlog) ); ERROR 1064 (42000): 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 '(idlog) )' at line 1 -- When the sun rises I receive and when it sets I forgive -> http://moj.skavt.net/gleskovs/ Always in Heart, Grega Leskovšek -- 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
[PHP] mysql error
Can smbd please look at this sentence - I got an error and do not know how to fix it - I am still very unfamiliar with MYSQL: CREATE TABLE log ( idlog int auto_increment not null, imepriimek varchar(50), clock timestamp, action varchar(30), onfile varchar(100), filesize float(6,2), uniqueid(idlog) ); ERROR 1064 (42000): 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 '(idlog) )' at line 1 -- When the sun rises I receive and when it sets I forgive -> http://moj.skavt.net/gleskovs/ Always in Heart, Grega Leskovšek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Rahul P wrote: Ok I removed mysql using yum remove mysql. But is there a special way to tell yum to install that version of mysql? On Sun, May 11, 2008 at 12:44 AM, Rahul P <[EMAIL PROTECTED]> wrote: On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote: Oh... This is the fourth time I'm doing that except that this time yum installed mysql6 instead of older versions... I don't see any way out other than reinstalling the OS itself... There are so many dependency failures I'm spending more time troubleshooting than actually coding something :) i dont even think mysql6 is any where near ready for real usage (tho could be wrong). can you see if you could put 5 or 5.1 on there instead? os reinstall sounds painful =/ -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com yum search mysql Find the one that looks like mysql5 or similar and use that. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 1:59 AM, Rahul P <[EMAIL PROTECTED]> wrote: > Ok. I apologize for the mix. When I'm mailing someone, I simply don't get > Google into mind. :) > no problem, if it were emerge id be much more capable of helping ;) -nathan
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Ok. I apologize for the mix. When I'm mailing someone, I simply don't get Google into mind. :) Thanks, Rahul On Sun, May 11, 2008 at 12:53 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > On Sun, May 11, 2008 at 1:46 AM, Rahul P <[EMAIL PROTECTED]> wrote: > >> Ok I removed mysql using yum remove mysql. But is there a special way to >> tell yum to install that version of mysql? > > > ahh, this is where google comes in for sure. it looks like you could > download an older rpm, like from mysql and use 'yum localinstall' or there > is a way to search for older versions that are still in the yum repos. > heres a quick link i found > > http://www.fedoraforum.org/forum/showthread.php?t=96684 > > -nathan > > -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 1:46 AM, Rahul P <[EMAIL PROTECTED]> wrote: > Ok I removed mysql using yum remove mysql. But is there a special way to > tell yum to install that version of mysql? ahh, this is where google comes in for sure. it looks like you could download an older rpm, like from mysql and use 'yum localinstall' or there is a way to search for older versions that are still in the yum repos. heres a quick link i found http://www.fedoraforum.org/forum/showthread.php?t=96684 -nathan
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Ok I removed mysql using yum remove mysql. But is there a special way to tell yum to install that version of mysql? On Sun, May 11, 2008 at 12:44 AM, Rahul P <[EMAIL PROTECTED]> wrote: > > > On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]> > wrote: > >> On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote: >> >>> Oh... This is the fourth time I'm doing that except that this time yum >>> installed mysql6 instead of older versions... I don't see any way out other >>> than reinstalling the OS itself... There are so many dependency failures >>> I'm spending more time troubleshooting than actually coding something :) >> >> >> i dont even think mysql6 is any where near ready for real usage (tho could >> be wrong). can you see if you could put 5 or 5.1 on there instead? os >> reinstall sounds painful =/ >> >> -nathan >> >> > > > -- > Rahul > Computer Engineering and Systems Division. > Department of Electrical Engineering and Computer Science > Robert R. McCormick School of Engineering > Northwestern University > 2145 Sheridan Road, Evanston,IL60208. > > Administrator: The En?gma Project > Website: http://www.enigmaportal.com > -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote: > >> Oh... This is the fourth time I'm doing that except that this time yum >> installed mysql6 instead of older versions... I don't see any way out other >> than reinstalling the OS itself... There are so many dependency failures >> I'm spending more time troubleshooting than actually coding something :) > > > i dont even think mysql6 is any where near ready for real usage (tho could > be wrong). can you see if you could put 5 or 5.1 on there instead? os > reinstall sounds painful =/ > > -nathan > > -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote: > Oh... This is the fourth time I'm doing that except that this time yum > installed mysql6 instead of older versions... I don't see any way out other > than reinstalling the OS itself... There are so many dependency failures > I'm spending more time troubleshooting than actually coding something :) i dont even think mysql6 is any where near ready for real usage (tho could be wrong). can you see if you could put 5 or 5.1 on there instead? os reinstall sounds painful =/ -nathan
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Oh... This is the fourth time I'm doing that except that this time yum installed mysql6 instead of older versions... I don't see any way out other than reinstalling the OS itself... There are so many dependency failures I'm spending more time troubleshooting than actually coding something :) On Sun, May 11, 2008 at 12:27 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > On Sun, May 11, 2008 at 1:22 AM, Rahul P <[EMAIL PROTECTED]> wrote: > >> Thanks. I just stopped mysql and when I try to start it again it throws >> another set of errors: >> >> chown: changing ownership of `/home-public/mysql6': Operation not >> permitted >> >> So I guess something is messed up completely. I wish I installed it >> better. Now the installing is messed up I guess with all sorts of bad files. >> I will try Google now... >> >> Thanks for the help... :) >> > > one benefit of package managers is that they let you uninstall and > reinstall easily. are you using yum or apt-get ? in your first post you > included both the commands.. anyway, id just uninstall and reinstall it; > should take 10 minutes or so. > > -nathan > > -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 1:22 AM, Rahul P <[EMAIL PROTECTED]> wrote: > Thanks. I just stopped mysql and when I try to start it again it throws > another set of errors: > > chown: changing ownership of `/home-public/mysql6': Operation not permitted > > So I guess something is messed up completely. I wish I installed it better. > Now the installing is messed up I guess with all sorts of bad files. I will > try Google now... > > Thanks for the help... :) > one benefit of package managers is that they let you uninstall and reinstall easily. are you using yum or apt-get ? in your first post you included both the commands.. anyway, id just uninstall and reinstall it; should take 10 minutes or so. -nathan
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Thanks. I just stopped mysql and when I try to start it again it throws another set of errors: chown: changing ownership of `/home-public/mysql6': Operation not permitted So I guess something is messed up completely. I wish I installed it better. Now the installing is messed up I guess with all sorts of bad files. I will try Google now... Thanks for the help... :) On Sun, May 11, 2008 at 12:17 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > On Sun, May 11, 2008 at 1:05 AM, Rahul <[EMAIL PROTECTED]> wrote: > >> I have recorded both the errors by changing the variable: >> >> $host = "mycomputer.webaddress.com" >> >> PHP Warning: mysql_connect(): Lost connection to MySQL server during >> query in /export/home/rpo219/may/conf_global.php on line 18 >> Lost connection to MySQL server during query > > > i have seen this before, but i cant recall, specifically what the problem > could be. i recommend google ;) > > >> $host = "localhost" >> >> PHP Warning: mysql_connect(): Can't connect to local MySQL server through >> socket '/var/lib/mysql/mysql.sock' (111) in >> /export/home/rpo219/may/conf_global.php on line 18 >> Can't connect to local MySQL server through socket >> '/var/lib/mysql/mysql.sock' >> > > i believe this is because the user root, does not have permission to > connect to the datbase from host 'localhost', especially since you said this > didnt work from the command line either. you will have to add a grant > clause to allow the root user to connect from the localhost. > > I found something weird for the first time: >> >> I tried looking at the mysql6 data directory and it says the following: >> >> total 28 >> drwxr-xr-x 3 nfsnobody nfsnobody 4096 May 10 23:57 . >> drwxrwxrwx 21 root root 4096 May 7 14:35 .. >> -rw-rw 1 nfsnobody nfsnobody 1009 May 10 23:57 >> mycomputer.webaddress.com.err >> drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql >> > > that is likely the way your distribution has designed the permission scheme > for the mysql server. > > And when I try to change the ownership of the directory to mysql by >> >> [EMAIL PROTECTED] chown mysql ./mysql6 >> chown: changing ownership of `./mysql6': Operation not permitted >> > > this is probly because you dont have permission to make the change... you > could do it via sudo, but i wouldnt recommend it. your distro has set it up > this way on purpose. > > >> Just thought it might be related to the problem > > > have you created any databases after installing mysql? you should create > at least one, like test db or something, and its good practice to create a > specific user to access the database through as well. instead of having php > connect as root. thats like a hackers dream right there. > > -nathan > > -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 1:05 AM, Rahul <[EMAIL PROTECTED]> wrote: > I have recorded both the errors by changing the variable: > > $host = "mycomputer.webaddress.com" > > PHP Warning: mysql_connect(): Lost connection to MySQL server during query > in /export/home/rpo219/may/conf_global.php on line 18 > Lost connection to MySQL server during query i have seen this before, but i cant recall, specifically what the problem could be. i recommend google ;) > $host = "localhost" > > PHP Warning: mysql_connect(): Can't connect to local MySQL server through > socket '/var/lib/mysql/mysql.sock' (111) in > /export/home/rpo219/may/conf_global.php on line 18 > Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' > i believe this is because the user root, does not have permission to connect to the datbase from host 'localhost', especially since you said this didnt work from the command line either. you will have to add a grant clause to allow the root user to connect from the localhost. I found something weird for the first time: > > I tried looking at the mysql6 data directory and it says the following: > > total 28 > drwxr-xr-x 3 nfsnobody nfsnobody 4096 May 10 23:57 . > drwxrwxrwx 21 root root 4096 May 7 14:35 .. > -rw-rw 1 nfsnobody nfsnobody 1009 May 10 23:57 > mycomputer.webaddress.com.err > drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql > that is likely the way your distribution has designed the permission scheme for the mysql server. And when I try to change the ownership of the directory to mysql by > > [EMAIL PROTECTED] chown mysql ./mysql6 > chown: changing ownership of `./mysql6': Operation not permitted > this is probly because you dont have permission to make the change... you could do it via sudo, but i wouldnt recommend it. your distro has set it up this way on purpose. > Just thought it might be related to the problem have you created any databases after installing mysql? you should create at least one, like test db or something, and its good practice to create a specific user to access the database through as well. instead of having php connect as root. thats like a hackers dream right there. -nathan
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
I have recorded both the errors by changing the variable: $host = "mycomputer.webaddress.com" PHP Warning: mysql_connect(): Lost connection to MySQL server during query in /export/home/rpo219/may/conf_global.php on line 18 Lost connection to MySQL server during query $host = "localhost" PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /export/home/rpo219/may/conf_global.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' I found something weird for the first time: I tried looking at the mysql6 data directory and it says the following: total 28 drwxr-xr-x 3 nfsnobody nfsnobody 4096 May 10 23:57 . drwxrwxrwx 21 root root 4096 May 7 14:35 .. -rw-rw 1 nfsnobody nfsnobody 1009 May 10 23:57 mycomputer.webaddress.com.err drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql And when I try to change the ownership of the directory to mysql by [EMAIL PROTECTED] chown mysql ./mysql6 chown: changing ownership of `./mysql6': Operation not permitted Just thought it might be related to the problem Thanks, Rahul Rahul wrote: Thanks a lot for your reply. I have tried using $host = "localhost"; $db = "dbname"; $table_main = "tablename"; $dbusername = "root"; $dbpass = "passhere"; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); and $host = "mycomputer.webaddress.com"; $db = "dbname"; $table_main = "tablename"; $dbusername = "root"; $dbpass = "passhere"; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); And this mycomputer.webaddress.com works when I use with mysql like this: mysql -h mycomputer.webaddress.com -u root -p Thank You Nathan Nobbe wrote: On Sun, May 11, 2008 at 12:30 AM, Rahul <[EMAIL PROTECTED]> wrote: I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h -u root -p However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? what is the hostname you are typing at the command line and what is the one you are using when trying to connect from php? when using mysql, you will have to have a separate entry for localhost connections. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
On Sun, May 11, 2008 at 12:42 AM, Rahul <[EMAIL PROTECTED]> wrote: > Thanks a lot for your reply. > > I have tried using > > $host = "localhost"; > $db = "dbname"; > $table_main = "tablename"; > $dbusername = "root"; > $dbpass = "passhere"; > > mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); > > and > > $host = "mycomputer.webaddress.com"; > $db = "dbname"; > $table_main = "tablename"; > $dbusername = "root"; > $dbpass = "passhere"; > > mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); > > And this mycomputer.webaddress.com works when I use with mysql like this: > > mysql -h mycomputer.webaddress.com -u root -p so, from above (previous post), it looks like the errors youve shown are actually coming from mysql_query(). what is the result of this (using credentials from this post and [mycomputer.webaddress.com])
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
Thanks a lot for your reply. I have tried using $host = "localhost"; $db = "dbname"; $table_main = "tablename"; $dbusername = "root"; $dbpass = "passhere"; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); and $host = "mycomputer.webaddress.com"; $db = "dbname"; $table_main = "tablename"; $dbusername = "root"; $dbpass = "passhere"; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); And this mycomputer.webaddress.com works when I use with mysql like this: mysql -h mycomputer.webaddress.com -u root -p Thank You Nathan Nobbe wrote: On Sun, May 11, 2008 at 12:30 AM, Rahul <[EMAIL PROTECTED]> wrote: I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h -u root -p However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? what is the hostname you are typing at the command line and what is the one you are using when trying to connect from php? when using mysql, you will have to have a separate entry for localhost connections. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
On Sun, May 11, 2008 at 12:30 AM, Rahul <[EMAIL PROTECTED]> wrote: > I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I > uninstalled both of them and installed again using the following commands: > > yum install mysql > > And then > > apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc > php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick > > And then started the mysql server. > > I am able to connect to the server from the console my typing > > mysql -h -u root -p > > However, when I try to connect to mysql through PHP I get the following > errors: > > PHP Warning: mysql_query(): Can't connect to local MySQL server through > socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php > on line 5 > PHP Warning: mysql_query(): A link to the server could not be established > in /export/home/rahul/may/sample.php on line 5 > Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > > Can someone please help me out? what is the hostname you are typing at the command line and what is the one you are using when trying to connect from php? when using mysql, you will have to have a separate entry for localhost connections. -nathan
[PHP] Re: PHP-MYSQL Error: Can't connect to MySQL socket. Can someone helpme out please?
By the way it installed MySQL 6 and PHP 5.0.4 and from the console this command does not work: mysql -u root -p but only this works: mysql -h -u root -p I tried doing the same while connecting to the database via php but it does not work. Rahul wrote: I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h -u root -p However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h -u root -p However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL error
Hello Wessley, Friday, July 1, 2005, 10:55:16 AM, you wrote: WR> $sql = "LOAD DATA LOCAL INFILE '/path/to/file.txt' INTO TABLE WR> `mytable` FIELDS TERMINATED BY '\t' ESCAPED BY '\' LINES TERMINATED WR> BY '\n'"; WR> mysql_query($sql) or die(''.mysql_error()); WR> I get this MySQL error: WR> You have an error in your SQL syntax. Check the manual that WR> corresponds to your MySQL server version for the right syntax to use WR> near ''' at line 2 It looks to me like the \n (linefeed) character is actually being turned into a line-feed character, because you've quoted the $sql variable with " " - hence it's gone and turned \t into a tab, \n into a line-feed, etc. I may be wrong, but I don't think MySQL likes this, and given the error you are receiving it looks like that might be the case. Quote it with ' ' to avoid translation of the \n and \t. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL error
Hi, I'm having a problem with the following code: $sql = "LOAD DATA LOCAL INFILE '/path/to/file.txt' INTO TABLE `mytable` FIELDS TERMINATED BY '\t' ESCAPED BY '\' LINES TERMINATED BY '\n'"; mysql_query($sql) or die(''.mysql_error()); I get this MySQL error: 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 ''' at line 2 What am I doing wrong? Doing this from phpMyAdmin works fine. Thanks, wes ··· Wessley Roche · Icon Designer · [EMAIL PROTECTED] · www.iconizer.com ··· -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
Mikey wrote: I have not changed any of my hostname/username/password code in the last 6 months and I can still connect to mysql.timerescue.co.uk via the command line interface. Has anyone seen this before - any ideas at all - just started happening today! :o( Strange indeed. I tried to connect first via the command line and it found your server and threw me out with invalid login details, but when I tried entering your servername into phpMyAdmin it couldn't resolve the hostname. However, when I replaced it with your server IP it returned to not liking my login details. Have there been any changes made to your DNS service of late? Or provider? Perhaps MySQL was upgraded and its no longer listening on correct IP/hostname? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] mysql error
Oooops! My mistake, I had a typo in my config file - it connects just fine either way... > -Original Message- > From: Mikey [mailto:[EMAIL PROTECTED] > Sent: 01 April 2005 13:16 > To: 'php-general@lists.php.net' > Subject: RE: [PHP] mysql error > > > >I have not changed any of my hostname/username/password code > > in the last 6 months and I can still connect to > mysql.timerescue.co.uk > > via the command line interface. > > > > > >Has anyone seen this before - any ideas at all - just > > started happening > > >today! :o( > > Strange indeed. > > I tried to connect first via the command line and it found > your server and threw me out with invalid login details, but > when I tried entering your servername into phpMyAdmin it > couldn't resolve the hostname. However, when I replaced it > with your server IP it returned to not liking my login details. > > Have there been any changes made to your DNS service of late? > Or provider? > > Mikey > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql error
> >I have not changed any of my hostname/username/password code > in the last 6 months and I can still connect to > mysql.timerescue.co.uk via the command line interface. > > > >Has anyone seen this before - any ideas at all - just > started happening > >today! :o( Strange indeed. I tried to connect first via the command line and it found your server and threw me out with invalid login details, but when I tried entering your servername into phpMyAdmin it couldn't resolve the hostname. However, when I replaced it with your server IP it returned to not liking my login details. Have there been any changes made to your DNS service of late? Or provider? Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
it cant find your host mysql.timerescue.co.uk try use an ip address... or try connect via the command line. Glen Beamson wrote: Hi, I have suddenly started getting an 'unknown host' error when trying to connect via php (see below). Unknown MySQL Server Host 'mysql.timerescue.co.uk' (0)2005 I have not changed any of my hostname/username/password code in the last 6 months and I can still connect to mysql.timerescue.co.uk via the command line interface. Has anyone seen this before - any ideas at all - just started happening today! :o( My code says this: // Connecting, selecting database $link = mysql_connect("mysql.timerescue.co.uk", "username", "password") or die('Could not connect: ' . mysql_error().mysql_errno()); Many thanks, Glen. Send instant messages to your online friends http://uk.messenger.yahoo.com -- Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql error
Hi, I have suddenly started getting an 'unknown host' error when trying to connect via php (see below). Unknown MySQL Server Host 'mysql.timerescue.co.uk' (0)2005 I have not changed any of my hostname/username/password code in the last 6 months and I can still connect to mysql.timerescue.co.uk via the command line interface. Has anyone seen this before - any ideas at all - just started happening today! :o( My code says this: // Connecting, selecting database $link = mysql_connect("mysql.timerescue.co.uk", "username", "password") or die('Could not connect: ' . mysql_error().mysql_errno()); Many thanks, Glen. Send instant messages to your online friends http://uk.messenger.yahoo.com
[PHP] MySQL Error 1251 / phpMyAdmin
I just installed phpMyAdmin 2.6.1 on my Windows Laptop with PHP Version 4.3.10 [Build Date Dec 14 2004 17:46:48] and mySql 4.1.8 I am receiving the enclosed error when I attempt to go into phpMyAdmin and do not know how to solve the issue... Any assistance would be greatful. Thank you Gary //## ERROR RECIEVED // Welcome to phpMyAdmin 2.6.1 phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server. Error MySQL said: #1251 - Client does not support authentication protocol requested by server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
Travis Conway wrote: Try: SELECT * FROM listing WHERE listing.state = 'WA' AND listing.type = 'RES' AND listing.county = 'clark' AND (listing.price > 15 OR listing.price <=20) Once again you have posted to the wrong list. Please send this message to the mysql list. This is the php list. -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
Try: SELECT * FROM listing WHERE listing.state = 'WA' AND listing.type = 'RES' AND listing.county = 'clark' AND (listing.price > 15 OR listing.price <=20) Try to not use the word "type". Do not know what it is but I have some problems using it. In the event you have weird problems, try putting the table name before the field like I did (i.e., listing.type). You probably also need the price in params since you want to OR just on those two items. I also assume that you have the price field as a int, bigint, or similar field type which does not require a tick around the value. I also dont think that the back tick works. HTH Travis - Original Message - From: "Richard Kurth" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, December 05, 2004 3:05 PM Subject: [PHP] mysql error Could somebody tell me way these query gets a error 1064 and does not work. error=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 '"SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' AND `county` = 'clark' AND `price` > '15' OR `price` <= '20'"; -- Best regards, Richard mailto:[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 error
Richard Kurth wrote: Could somebody tell me way these query gets a error 1064 and does not work. no. wrong list. -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
> query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' > AND `county` = 'clark' AND (`price` > '15' OR `price` <= '20');"; if that doesn't work - break it down into individual parts and find out where the problem is. Respectfully, Ligaya Turmelle --- Life is a game... so have fun. --- www.PHPCommunity.org Open Source, Open Community Visit for more information or to join the movement Richard Kurth wrote: Could somebody tell me way these query gets a error 1064 and does not work. error=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 '"SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' AND `county` = 'clark' AND `price` > '15' OR `price` <= '20'"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql error
Could somebody tell me way these query gets a error 1064 and does not work. error=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 '"SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES' AND `county` = 'clark' AND `price` > '15' OR `price` <= '20'"; -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php/mysql error....why?
Hi, Saturday, October 25, 2003, 2:50:46 AM, you wrote: RA> Hi, RA> I am running a very simple query to the database, basically select all the RA> firms which start with 0-9, RA> eg. RA> 1stcompany RA> 3isgood RA> etc RA> using this: RA> $qry = "select cust_no,firm from companies where firm LIKE `%0123456789%'"; RA> It gives me this error: RA> Error: Unknown column '0123456789%'' in 'where clause' RA> any idea why its ignoring the LIKE statement? the funny part is LIKE is RA> working for another program.. RA> What am i missing? RA> Thanks, RA> -Ryan You have a backtick instead of a quote (`%) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Php/mysql error....why?
> `%0123456789%'"; You have a ` instead a ' before the %0123. I believe that is what is causing your grief. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php/mysql error....why?
Hi, I am running a very simple query to the database, basically select all the firms which start with 0-9, eg. 1stcompany 3isgood etc using this: $qry = "select cust_no,firm from companies where firm LIKE `%0123456789%'"; It gives me this error: Error: Unknown column '0123456789%'' in 'where clause' any idea why its ignoring the LIKE statement? the funny part is LIKE is working for another program.. What am i missing? Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: PHP & Mysql Error Code 1062 - Duplicates found
Hi All, I found out how to do it already. Thanks for the help. mysql_error() was the key.. Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -Original Message- From: Ow Mun Heng Sent: Wednesday, June 25, 2003 10:03 AM To: [EMAIL PROTECTED] Subject: PHP & Mysql Error Code 1062 - Duplicates found Hi PHP'ers, I've got a question regarding the input of (multiple) data into mysql through PHP. If there is already an entry in the database, then an mysql will generate an error 1062 stating that the entry is a duplicate. (This will happen only if I input the data through mySQL using xterm, if I use PHP, then I only get the 'duplicate entry found', partly cause I don't know how to get the error code as well as the duplicate entry returned to PHP to be output'ed to the browser. Below is my code. $my_query is concatenated from an array. $my_query = $my_query. "\n('".$SN[$i]."','".$DCM[$i]."','".$Supp[$i]."','".$time_now."'),"; $query = "INSERT INTO pioneer(serial_no,dcm,supplier,fa_timestamp) VALUES $my_query;"; $result = mysql_db_query('tracker',$query); if ($result) echo "".mysql_affected_rows()." Drives & DCM combo inserted into database."; else echo "\nDuplicate entry found. Data not inserted."; Can anyone help me out? Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & Mysql Error Code 1062 - Duplicates found
On Jun 25, 2003, "Ow Mun Heng" claimed that: |Hi PHP'ers, | | I've got a question regarding the input of (multiple) data into |mysql through PHP. | |If there is already an entry in the database, then an mysql will generate an |error 1062 stating that the entry is a duplicate. (This will happen only if |I input the data through mySQL using xterm, if I use PHP, then I only get |the 'duplicate entry found', partly cause I don't know how to get the error |code as well as the duplicate entry returned to PHP to be output'ed to the |browser. | |Below is my code. $my_query is concatenated from an array. | |$my_query = $my_query. |"\n('".$SN[$i]."','".$DCM[$i]."','".$Supp[$i]."','".$time_now."'),"; |$query = "INSERT INTO pioneer(serial_no,dcm,supplier,fa_timestamp) VALUES |$my_query;"; |$result = mysql_db_query('tracker',$query); | |if ($result) |echo "".mysql_affected_rows()." Drives & DCM combo inserted into |database."; |else |echo "\nDuplicate entry found. Data not inserted."; | | |Can anyone help me out? | | |Cheers, |Mun Heng, Ow |H/M Engineering |Western Digital M'sia |DID : 03-7870 5168 | |-- http://marc.theaimsgroup.com/?l=php-general&m=105606491624771&w=2 -- Registered Linux user #304026. "lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP & Mysql Error Code 1062 - Duplicates found
Hi PHP'ers, I've got a question regarding the input of (multiple) data into mysql through PHP. If there is already an entry in the database, then an mysql will generate an error 1062 stating that the entry is a duplicate. (This will happen only if I input the data through mySQL using xterm, if I use PHP, then I only get the 'duplicate entry found', partly cause I don't know how to get the error code as well as the duplicate entry returned to PHP to be output'ed to the browser. Below is my code. $my_query is concatenated from an array. $my_query = $my_query. "\n('".$SN[$i]."','".$DCM[$i]."','".$Supp[$i]."','".$time_now."'),"; $query = "INSERT INTO pioneer(serial_no,dcm,supplier,fa_timestamp) VALUES $my_query;"; $result = mysql_db_query('tracker',$query); if ($result) echo "".mysql_affected_rows()." Drives & DCM combo inserted into database."; else echo "\nDuplicate entry found. Data not inserted."; Can anyone help me out? Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql error messages
Hi. I have parsed the txt file and put it on my site . it's kinda ugly and messy, but maybe it helps someone. http://www.thomash.co.za/docs/errmsg.php T
RE: [PHP] MySQL error
--> line 36 while($row = mysql_fetch_row($mysql_result)) >> >>Anyway, where do you define $row? >> >>HTH >> >>-Craig DOH! it's been a long one... -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL error
You need to do some error handling, as in: > $mysql_result = mysql_query($query, $mysql_link); > > // get each row > > --> line 36 while($row = mysql_fetch_row($mysql_result)) > Make sure $mysql_result is a valid resource as PHP is telling you it's not. Here's one way: if (!$mysql_result) { echo "DB Error ($query) : " . mysql_error(); exit; } while ($row = mysql_fetch_row($mysql_result)) { } See? We made sure $mysql_result isn't false as the function mysql_query returns false on failure. If it is false, we print some useful info out to debug it. In production, you most likely won't want to print it out but anyway... For a more complete example, see: http://www.php.net/mysql_fetch_assoc Btw, being that there is a function named mysql_result I wouldn't create a variable by that name, kinda confusing. Regards, Philip Olson p.s. mysql_error is your friend. > { > > //get columns > > $id = $row[0]; > $ynimi = $row[1]; > $ylahi = $row[2]; > $ypostios = $row[3]; > $ypostitmp = $row[11]; > > print("\n"); > print("\n"); > > print("$ynimi, $ylahi, $ypostios > $ypostitmp\n"); > print(" HREF=\"tarkenna.php3?id=$id\">MUOKKAA> - HREF=\"poista.php3?id=$id\">POISTA>"); > > print("\n"); > print("\n"); > > } > > // disconnect > mysql_close($mysql_link); > ?> > > when run, i'll following error messages: > > Warning: mysql_fetch_row(): supplied argument is not a valid MySQL > result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 > on line 36 > > > > -- > 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 error
>> $mysql_result = mysql_query($query, $mysql_link); I am not sure if this is your only problem or not, but mysql_result(); is a function in php. Using a function name as a variable seems like it will just lead to confusion to me. I'd try to avoid it. >>--> line 36 while($row = mysql_fetch_row($mysql_result)) Anyway, where do you define $row? HTH -Craig >>-Original Message- >>From: GWAD Mailinglist [mailto:[EMAIL PROTECTED]] >>Sent: Thursday, December 12, 2002 6:01 PM >>To: [EMAIL PROTECTED] >>Subject: [PHP] MySQL error >> >> >>Hi, >> >>I have following problem: >> >>list.php3 >> >>> >>// connect to db >>include("connect_db.php3"); >> >> // get everything from catalog table >> >>$query = "SELECT * FROM yritykset ORDER BY ynimi ASC"; >> >> $mysql_result = mysql_query($query, $mysql_link); >> >>// get each row >> >>--> line 36 while($row = mysql_fetch_row($mysql_result)) >> >>{ >> >>//get columns >> >> $id = $row[0]; >> $ynimi = $row[1]; >> $ylahi = $row[2]; >> $ypostios = $row[3]; >> $ypostitmp = $row[11]; >> >> print("\n"); >> print("\n"); >> >> print("$ynimi, $ylahi, $ypostios >>$ypostitmp\n"); >> print(">HREF=\"tarkenna.php3?id=$id\">MUOKKAA> - >HREF=\"poista.php3?id=$id\">POISTA>"); >> >> print("\n"); >> print("\n"); >> >>} >> >>// disconnect >>mysql_close($mysql_link); >>?> >> >>when run, i'll following error messages: >> >>Warning: mysql_fetch_row(): supplied argument is not a valid MySQL >>result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 >>on line 36 >> >> >> >>-- >>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 error
Well, are you getting a valied response from the database? Perhaps it would be nice to add some error handling into your code... i.e.: $mysql_result = mysql_query($query, $mysql_link) or die("Invalid query: $query"); or echo out mysql_error(); GWAD Mailinglist wrote: > Hi, > > I have following problem: > > list.php3 > > > // connect to db > include("connect_db.php3"); > > // get everything from catalog table > > $query = "SELECT * FROM yritykset ORDER BY ynimi ASC"; > > $mysql_result = mysql_query($query, $mysql_link); > > // get each row > > --> line 36 while($row = mysql_fetch_row($mysql_result)) > > { > > //get columns > > $id = $row[0]; > $ynimi = $row[1]; > $ylahi = $row[2]; > $ypostios = $row[3]; > $ypostitmp = $row[11]; > > print("\n"); > print("\n"); > > print("$ynimi, $ylahi, $ypostios > $ypostitmp\n"); > print(" HREF=\"tarkenna.php3?id=$id\">MUOKKAA> - HREF=\"poista.php3?id=$id\">POISTA>"); > > print("\n"); > print("\n"); > > } > > // disconnect > mysql_close($mysql_link); > ?> > > when run, i'll following error messages: > > Warning: mysql_fetch_row(): supplied argument is not a valid MySQL > result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 > on line 36 > > -- > 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
[PHP] MySQL error
Hi, I have following problem: list.php3 line 36 while($row = mysql_fetch_row($mysql_result)) { //get columns $id = $row[0]; $ynimi = $row[1]; $ylahi = $row[2]; $ypostios = $row[3]; $ypostitmp = $row[11]; print("\n"); print("\n"); print("$ynimi, $ylahi, $ypostios $ypostitmp\n"); print("MUOKKAA> - POISTA>"); print("\n"); print("\n"); } // disconnect mysql_close($mysql_link); ?> when run, i'll following error messages: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 on line 36 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Error
I did that and it didn't output anything... - Original Message - From: "Brad Bonkoski" <[EMAIL PROTECTED]> To: "Stephen" <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Sunday, December 01, 2002 2:55 PM Subject: Re: [PHP] MySQL Error > Perhaps you should try and do some error checking on the mysql_select_db() > function, like printing out mysql_error(). > > Also, for the permissions issues, mysql has a very comprehensive online > documentation on user permissions. Check them out, you may also wish to try > and connect to the database with a different user? > http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Adm inistration.html#Adding_users > > HTH > -Brad > > Stephen wrote: > > > Hello, > > > > I just recently switched to IIS from Apache since IIS came with Windows XP > > and I just love Microsoft. I installed PHP and MySQL with no problems but > > when I tried accessing a table, I got this error: > > > > No Database Selected > > > > In my script, I have this: > > > > $hostname_default = "localhost"; > > $database_default = "check"; > > $username_default = "root"; > > $password_default = " **taken out for known reasons** "; > > $default = mysql_pconnect($hostname_default, $username_default, > > $password_default) or die(mysql_error()); > > mysql_select_db($database_default, $default); > > $query_update = "SELECT * FROM updates ORDER BY `date` DESC LIMIT 1"; > > $update = mysql_query($query_update, $default) or die(mysql_error()); > > $row_update = mysql_fetch_assoc($update); > > $totalRows_update = mysql_num_rows($update); > > > > I don't see where it's gone wrong! My database name is check and phpMyAdmin > > can get to it just fine. Also, how can I set it up so MySQL allows the user > > name root and no password acessable through localhost? I accidently changed > > it to only allow username root, with password... > > > > Thanks, > > Stephen Craton > > http://www.melchior.us > > > > "What is a dreamer that can not persevere?" -- http://www.melchior.us > > > > > -- > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Error
Perhaps you should try and do some error checking on the mysql_select_db() function, like printing out mysql_error(). Also, for the permissions issues, mysql has a very comprehensive online documentation on user permissions. Check them out, you may also wish to try and connect to the database with a different user? http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Adding_users HTH -Brad Stephen wrote: > Hello, > > I just recently switched to IIS from Apache since IIS came with Windows XP > and I just love Microsoft. I installed PHP and MySQL with no problems but > when I tried accessing a table, I got this error: > > No Database Selected > > In my script, I have this: > > $hostname_default = "localhost"; > $database_default = "check"; > $username_default = "root"; > $password_default = " **taken out for known reasons** "; > $default = mysql_pconnect($hostname_default, $username_default, > $password_default) or die(mysql_error()); > mysql_select_db($database_default, $default); > $query_update = "SELECT * FROM updates ORDER BY `date` DESC LIMIT 1"; > $update = mysql_query($query_update, $default) or die(mysql_error()); > $row_update = mysql_fetch_assoc($update); > $totalRows_update = mysql_num_rows($update); > > I don't see where it's gone wrong! My database name is check and phpMyAdmin > can get to it just fine. Also, how can I set it up so MySQL allows the user > name root and no password acessable through localhost? I accidently changed > it to only allow username root, with password... > > Thanks, > Stephen Craton > http://www.melchior.us > > "What is a dreamer that can not persevere?" -- http://www.melchior.us > > > -- > 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
[PHP] MySQL Error
Hello, I just recently switched to IIS from Apache since IIS came with Windows XP and I just love Microsoft. I installed PHP and MySQL with no problems but when I tried accessing a table, I got this error: No Database Selected In my script, I have this: $hostname_default = "localhost"; $database_default = "check"; $username_default = "root"; $password_default = " **taken out for known reasons** "; $default = mysql_pconnect($hostname_default, $username_default, $password_default) or die(mysql_error()); mysql_select_db($database_default, $default); $query_update = "SELECT * FROM updates ORDER BY `date` DESC LIMIT 1"; $update = mysql_query($query_update, $default) or die(mysql_error()); $row_update = mysql_fetch_assoc($update); $totalRows_update = mysql_num_rows($update); I don't see where it's gone wrong! My database name is check and phpMyAdmin can get to it just fine. Also, how can I set it up so MySQL allows the user name root and no password acessable through localhost? I accidently changed it to only allow username root, with password... Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that can not persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mysql error
Check file and drectory permisions. ROBERT MCPEAK wrote: >Our box recently went down and after reconfiguring it we're left with a >semi-operation mySQL. One error I'm getting is this: > >mysql> select region from clip_art where region is not null and >released = 'yes' group by region; >ERROR 1: Can't create/write to file '/tmp/#sqld0e_76_1.MYI' (Errcode: >13) > >Removing the "group by" clause prevents the error. > >Can anybody tell me how to fix this? > >Thank you. > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php mysql error
[snip] Our box recently went down and after reconfiguring it we're left with a semi-operation mySQL. One error I'm getting is this: mysql> select region from clip_art where region is not null and released = 'yes' group by region; ERROR 1: Can't create/write to file '/tmp/#sqld0e_76_1.MYI' (Errcode: 13) Removing the "group by" clause prevents the error. [/snip] Using perror 13 I get; root@myserver:/var/www/htdocs# perror 13 Error code 13: Permission denied So perhaps /tmp/ or #sqld0e_76_1.MYI has the wrong permissions HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mysql error
whats the permissions on /tmp? it should be set to 1777 Adam On Wed, 4 Sep 2002, ROBERT MCPEAK wrote: > Our box recently went down and after reconfiguring it we're left with a > semi-operation mySQL. One error I'm getting is this: > > mysql> select region from clip_art where region is not null and > released = 'yes' group by region; > ERROR 1: Can't create/write to file '/tmp/#sqld0e_76_1.MYI' (Errcode: > 13) > > Removing the "group by" clause prevents the error. > > Can anybody tell me how to fix this? > > Thank you. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php mysql error
Our box recently went down and after reconfiguring it we're left with a semi-operation mySQL. One error I'm getting is this: mysql> select region from clip_art where region is not null and released = 'yes' group by region; ERROR 1: Can't create/write to file '/tmp/#sqld0e_76_1.MYI' (Errcode: 13) Removing the "group by" clause prevents the error. Can anybody tell me how to fix this? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql error
Yes, thank you very much, I shouldn$B!G(Bt code late at night without any caffeine in me. - Vic -Original Message- From: @ Edwin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 12:29 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] mysql error Looks like you're updating your table so instead of "INSERT INTO...", try: "UPDATE malibu_data SET ..." HTH, - E > >I get this error: > >Error submiting paragraph.You have an error in your SQL syntax near >'WHERE page_name='features' AND par_id='13' ' at line 1 > > >But my code, I think is fine: > >// Insert the form information into the database > mysql_query("INSERT INTO malibu_data SET heading='$heading', >paragraph='$paragraph' >WHERE page_name='$page_name' AND par_id='$par_id' ") > or die ('Error submiting paragraph.'. mysql_error()); > > >- Vic > > > >__ >Post your ad for free now! http://personals.yahoo.ca > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ $B%O%$%;%s%9$J>&IJ$r5$7Z$K9XF~(B MSN $B%7%g%C%T%s%0(B http://shopping.msn.co.jp/ __ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error
it's the WHERE clause, it's illegal there. what are you trying to do? if you want to change the heading & paragraph columns of every row in malibu_data where the page_name & par_id match your values, this should be an UPDATE. if you want to create a new record in malibu_data for every record that meets your criteria - which would be a kind of strange thing to do, but whatever - you'd need to write it like insert into malibu_data (heading,paragraph) select '$heading', '$paragraph' from malibu_data where page_name = '$page_name' and par_id = '$par_id' Always try to run your queries in MySQL directly first. You'd see the same error, and remove worries about any kind of PHP coding problem. On Wed, 14 Aug 2002 [EMAIL PROTECTED] wrote: > I get this error: > > Error submiting paragraph.You have an error in your SQL syntax near > 'WHERE page_name='features' AND par_id='13' ' at line 1 > > > But my code, I think is fine: > > // Insert the form information into the database > mysql_query("INSERT INTO malibu_data SET heading='$heading', > paragraph='$paragraph' > WHERE page_name='$page_name' AND par_id='$par_id' ") > or die ('Error submiting paragraph.'. mysql_error()); > > > - Vic > > > > __ > Post your ad for free now! http://personals.yahoo.ca > > -- > 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 error
Looks like you're updating your table so instead of "INSERT INTO...", try: "UPDATE malibu_data SET ..." HTH, - E > >I get this error: > >Error submiting paragraph.You have an error in your SQL syntax near >'WHERE page_name='features' AND par_id='13' ' at line 1 > > >But my code, I think is fine: > >// Insert the form information into the database > mysql_query("INSERT INTO malibu_data SET heading='$heading', >paragraph='$paragraph' >WHERE page_name='$page_name' AND par_id='$par_id' ") > or die ('Error submiting paragraph.'. mysql_error()); > > >- Vic > > > >__ >Post your ad for free now! http://personals.yahoo.ca > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ $B%O%$%;%s%9$J>&IJ$r5$7Z$K9XF~(B MSN $B%7%g%C%T%s%0(B http://shopping.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql error
I get this error: Error submiting paragraph.You have an error in your SQL syntax near 'WHERE page_name='features' AND par_id='13' ' at line 1 But my code, I think is fine: // Insert the form information into the database mysql_query("INSERT INTO malibu_data SET heading='$heading', paragraph='$paragraph' WHERE page_name='$page_name' AND par_id='$par_id' ") or die ('Error submiting paragraph.'. mysql_error()); - Vic __ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/MySQL Error Log Parser
How can I set up MySQL error logging? Is there any PHP MySQL error log parsers? Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error or PHP
Justin French wrote: > try add_slashes($string) before inserting into the database, or turn on > magic quotes in php.ini Or Mysql_Escape_String() http://www.php.net/manual/en/function.mysql-escape-string.php Or Mysql_Real_Escape_String() http://www.php.net/manual/en/function.mysql-real-escape-string.php Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql error or PHP
try add_slashes($string) before inserting into the database, or turn on magic quotes in php.ini justin french on 15/07/02 5:57 PM, Wilbert Enserink ([EMAIL PROTECTED]) wrote: > Hi all, > > > has anybody ever seen this? And knows what it means? > thx. > > You have an error in your SQL syntax near 's self-supporting ribbed form was > probably not strong enough to render the desig' at line 1 > > > regards Wilbert > > > - > Pas de Deux > Van Mierisstraat 25 > 2526 NM Den Haag > tel 070 4450855 > fax 070 4450852 > http://www.pdd.nl > [EMAIL PROTECTED] > - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql error or PHP
Hi all, has anybody ever seen this? And knows what it means? thx. You have an error in your SQL syntax near 's self-supporting ribbed form was probably not strong enough to render the desig' at line 1 regards Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] -
Re: [PHP] mysql error
The mysql_select_db() function is going to return a handle. You need to capture that handle and use it as the second parameter in your mysql_query() function. Although this is not required in certain cases where the server automatically knows which database to work with, chances are thats whats giving you the error. Use like this.. $db = mysql_select_db(); mysql_query($query, $db); -Kevin - Original Message - From: "Randum Ian" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Friday, May 17, 2002 11:45 AM Subject: [PHP] mysql error > Hi all, > > I have got this code but I can get it to work, it doesnt make sense! > > > > $host="localhost"; > $username="user"; > $password="pass"; > $database="admin"; > > $mysqlconnect = mysql_connect($host, $username, $password) or die ("Cannot > connect to mySQL server, check it is running"); > > mysql_select_db($database, $mysqlconnect) or die ("Cannot connect to the > database, check it is set right"); > > $result = mysql_query("SELECT * FROM user"); > > $count = mysql_num_rows($result); > > $counted = number_format($count); > > echo $counted; > > ?> > > > but I am getting this error - "Warning: Supplied argument is not a valid > MySQL result resource in /usr/home/e/a/eagadmin/public_html/main.php on line > 14" but I dont understand why! > > Can anyone help? > > Regards, Ian. > --- > Randum Ian > DJ / Reviewer / Webmaster, DancePortal (UK) Limited > [EMAIL PROTECTED] > http://www.danceportal.co.uk > DancePortal.co.uk - Global dance music media > > > -- > 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
[PHP] mysql error
Hi all, I have got this code but I can get it to work, it doesnt make sense! but I am getting this error - "Warning: Supplied argument is not a valid MySQL result resource in /usr/home/e/a/eagadmin/public_html/main.php on line 14" but I dont understand why! Can anyone help? Regards, Ian. --- Randum Ian DJ / Reviewer / Webmaster, DancePortal (UK) Limited [EMAIL PROTECTED] http://www.danceportal.co.uk DancePortal.co.uk - Global dance music media -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MYSQL ERROR CONNECT
> Warning: Access denied for user: 'nobody@localhost' (Using password: NO) > in /www/host/doms/com/smpk2/create_tables.php on line 15 Hmm...let me see if I can decrypt that message. Apparently you were denied access with user nobody and you were not using a password. Read the manual page on mysql_connect(), you're missing some arguments. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MYSQL ERROR CONNECT
Thanks radix! I'm new to PHP that's why.. so, what should I do to fix this? please advise.. thanks again. Dani The_RadiX wrote: > Ha.. Aussie person too eh? > > Ok.. Have you recently updated your php system? > > Reason I ask is the way you are using the functions mysql_connect and > mysql_select_db are quite ... "bad" to say the least > > You should have permissions setup for a root account or something in your > mysql.user table and then you can do this: > > $DB=mysql_connect("localhost","root","password"); > > notice I now have a user/pass arg and also I am assigning the handle of the > connection to a var ($DB) > > then use: > > mysql_select_db("smpk2",$DB); > > and that should work fine as long as user and pass are right and db exists.. > (and server has mysql running of course :P ) > > if not.. let us know.. > > If you want to know how to setup users and permissions for MySQL.. give us a > yell.. be glad to help out.. > > ::: > : Julien Bonastre [The-Spectrum.org CEO] > : A.K.A. The_RadiX > : [EMAIL PROTECTED] > : ABN: 64 235 749 494 > : QUT Student #: 04475739 > ::::::::::: > - Original Message - > From: "Dani" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, May 06, 2002 11:49 PM > Subject: [PHP] MYSQL ERROR CONNECT > > > Hi, > > I have been using this code for while: > > > > //1. CONNECT TO DATABASE > > mysql_connect("localhost"); > > > > //2. SELECT A DATABASE > > mysql_select_db("smpk2"); > > > > to connect to MYSQL database. > > > > but I get this error: > > > > Warning: Access denied for user: 'nobody@localhost' (Using password: NO) > > in /www/host/doms/com/smpk2/create_tables.php on line 15 > > > > Warning: MySQL Connection Failed: Access denied for user: > > 'nobody@localhost' (Using password: NO) in > > /www/host/doms/com/smpk2/create_tables.php on line 15 > > > > could someone help me, please??? > > > > thanks > > > > > > > > -- > > 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 ERROR CONNECT
Ha.. Aussie person too eh? Ok.. Have you recently updated your php system? Reason I ask is the way you are using the functions mysql_connect and mysql_select_db are quite ... "bad" to say the least You should have permissions setup for a root account or something in your mysql.user table and then you can do this: $DB=mysql_connect("localhost","root","password"); notice I now have a user/pass arg and also I am assigning the handle of the connection to a var ($DB) then use: mysql_select_db("smpk2",$DB); and that should work fine as long as user and pass are right and db exists.. (and server has mysql running of course :P ) if not.. let us know.. If you want to know how to setup users and permissions for MySQL.. give us a yell.. be glad to help out.. ::: : Julien Bonastre [The-Spectrum.org CEO] : A.K.A. The_RadiX : [EMAIL PROTECTED] : ABN: 64 235 749 494 : QUT Student #: 04475739 ::: - Original Message - From: "Dani" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 06, 2002 11:49 PM Subject: [PHP] MYSQL ERROR CONNECT > Hi, > I have been using this code for while: > > //1. CONNECT TO DATABASE > mysql_connect("localhost"); > > //2. SELECT A DATABASE > mysql_select_db("smpk2"); > > to connect to MYSQL database. > > but I get this error: > > Warning: Access denied for user: 'nobody@localhost' (Using password: NO) > in /www/host/doms/com/smpk2/create_tables.php on line 15 > > Warning: MySQL Connection Failed: Access denied for user: > 'nobody@localhost' (Using password: NO) in > /www/host/doms/com/smpk2/create_tables.php on line 15 > > could someone help me, please??? > > thanks > > > > -- > 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
[PHP] MYSQL ERROR CONNECT
Hi, I have been using this code for while: //1. CONNECT TO DATABASE mysql_connect("localhost"); //2. SELECT A DATABASE mysql_select_db("smpk2"); to connect to MYSQL database. but I get this error: Warning: Access denied for user: 'nobody@localhost' (Using password: NO) in /www/host/doms/com/smpk2/create_tables.php on line 15 Warning: MySQL Connection Failed: Access denied for user: 'nobody@localhost' (Using password: NO) in /www/host/doms/com/smpk2/create_tables.php on line 15 could someone help me, please??? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL error checking/matching
- Original Message - From: "Navid Yar" <[EMAIL PROTECTED]> > $query = "select email from customers" // Check for duplicate > entry > . "where email = $email"; > $query = stripslashes($query); > $result = mysql_query($query); > > $num_results = mysql_num_rows($result); // Get the number of > rows in database (integer) > And this produces the following error: > Warning: Supplied argument is not a valid MySQL result resource in > e:\localhost/book-o-rama/admin/signup_do.php on line 34. > > What am I doing wrong? Any help would be appreciated... You are not checking to see if the mysql_query completed successfully. What you could do is: $result = mysql_query($query) or die(mysql_error()); http://www.php-faq.com/faq.php#10 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL error checking/matching
Hello everyone, I have a problem. I have a test database (used to learn MySQL) with a table called customers and a field called email. The email field is set to be unique, so I know that by using: $query = "select email from customers where email = $email"; I will get one cell with the e-mail address that matches the email address specified by the variable $e-mail. Basically, I want to check to see if the e-mail address set in the variable $email matches the email address in the field named email. But I get an error at the end. Here's the source: Assumptions: - $email is set from a previous page - a database connection is open and the database to be used is selected - session settings will send $error back to the form page if result of if statement below is true $query = "select email from customers" // Check for duplicate entry . "where email = $email"; $query = stripslashes($query); $result = mysql_query($query); $num_results = mysql_num_rows($result); // Get the number of rows in database (integer) for ($i = 0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); // Return results in an associative array } if($row["email"] == $email) { // Check to see if $email matches in database $error = "$email has already been registered"; header("Location: signup.php?"); exit; } And this produces the following error: Warning: Supplied argument is not a valid MySQL result resource in e:\localhost/book-o-rama/admin/signup_do.php on line 34. What am I doing wrong? Any help would be appreciated... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL error... but it works!!??
Hi, So far the best way to troubleshoot mysql+php for me has been to add an "or die" after the sql exec. $crdate = date("Y-m-d"); $result = mysql_query("SELECT * FROM sites WHERE creation_date = '$crdate' AND status = 'T'") or die ('CAN NOT EXEC SQL'); Or you can do $sql = "SELECT * FROM sites WHERE creation_date = '$crdate' AND status = 'T'"; echo $sql; $result = mysql_query($sql) or die .; and try to run your sql against mysql directly to make sure your sql is fine. one thing to always check is your connection to the database. did you connect? Simon Kimber <[EMAIL PROTECTED]> wrote: Does anyone have any idea why this is giving me a "Warning: Supplied argument is not a valid MySQL result resource in..." error? The funny thing is that apart from that error message it works perfectly!! --- $crdate = date("Y-m-d"); $result = mysql_query("SELECT * FROM sites WHERE creation_date = '$crdate' AND status = 'T'"); while ($sitedata = mysql_fetch_array($result)) { echo $sitedata['name'] . " "; } --- Cheers Simon -- 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] Mehmet Erisen http://www.erisen.com - Do You Yahoo!? Send FREE video emails in Yahoo! Mail.
Fw: [PHP] MySQL error... but it works!!??
- Original Message - From: "Bas van Rooijen" <[EMAIL PROTECTED]> To: "Adam Baratz" <[EMAIL PROTECTED]> Sent: Saturday, January 05, 2002 4:39 PM Subject: Re: [PHP] MySQL error... but it works!!?? > > maybe try: > > if (!$result) > { >echo(mysql_error()); > } > > bvr. > On Sat, 5 Jan 2002 15:55:39 -0500, Adam Baratz wrote: > > >> Does anyone have any idea why this is giving me a "Warning: Supplied > >> argument is not a valid MySQL result resource in..." error? > > > >You'll have to give more code, which line you get that error from, etc., to > >give us a better idea why it's "not working." > > > >However, a quick tip: > > > >> $crdate = date("Y-m-d"); > >> $result = mysql_query("SELECT * FROM sites WHERE creation_date = '$crdate' > >> AND status = 'T'"); > > > >These two lines can be condensed since MySQL has a built-in function to get > >the current time/date: > > > >SELECT * FROM sites WHERE creation_date = NOW() AND status = 'T' > > > >-Adam > > > > > >-- > >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 error... but it works!!??
> Does anyone have any idea why this is giving me a "Warning: Supplied > argument is not a valid MySQL result resource in..." error? You'll have to give more code, which line you get that error from, etc., to give us a better idea why it's "not working." However, a quick tip: > $crdate = date("Y-m-d"); > $result = mysql_query("SELECT * FROM sites WHERE creation_date = '$crdate' > AND status = 'T'"); These two lines can be condensed since MySQL has a built-in function to get the current time/date: SELECT * FROM sites WHERE creation_date = NOW() AND status = 'T' -Adam -- 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] MySQL error... but it works!!??
Does anyone have any idea why this is giving me a "Warning: Supplied argument is not a valid MySQL result resource in..." error? The funny thing is that apart from that error message it works perfectly!! --- $crdate = date("Y-m-d"); $result = mysql_query("SELECT * FROM sites WHERE creation_date = '$crdate' AND status = 'T'"); while ($sitedata = mysql_fetch_array($result)) { echo $sitedata['name'] . ""; } --- Cheers Simon -- 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] MySql error
Hi ! I made the upgrade of MySQL, since 3.21 to 3.23, and, inmediatly this change, all perl programs that uses MySQL write at the STDERR, this bug SV = RV(0x84ec388) at 0xb2f0 REFCNT = 1 FLAGS = (ROK,READONLY) RV = 0x8552d3c I've installed: DBD::mysql 2.0902 DBI 1.20 DBI::DBD 11.02 Can somebody help me ? Regards, Carlos. -- 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] PHP/Mysql error handling
Hi, Is there any way to make php notify me of any errors through email? I know it may sounds funny, but imagine having this huge site and u just want it to run smoothly but u juct cant check it all the time . If there was a way that php would notify u for a an error on a specific page/line that would make debuggin much easier and without guessing.. So, is it possible? Thanks. -- phaistonian -- 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] mysql error on win2k
hi, i have installed win2k and configured apache and php4.0.6 but mysql is giving error 1016 or so. why is this happening. /sagar
Re: [PHP] MySQL Error.
On Fri, 17 Aug 2001 16:49, ERISEN, Mehmet Kamil wrote: > Hello All, > I receive the following warning message. When I reload the page, the > message is the error message does not show up again. Funny thing is, > that there are other parts of the page generated from the same database > using the same mysql_pconnect and they are fine. I am using a standard > $sql mysql_query($sql) mysql_fetch_array($result) kind of command, > nothing too fancy. Did anybody have a similar experince? > > Warning: Supplied argument is not a valid MySQL result resource in > /xxx/xxx//index.php on line 45 > > > thanks. Use mysql_error() after your call to mysql to give you the error that is causing your query to fail. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Dislexics of the world, UNTIE! -- 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] MySQL Error.
Hello All, I receive the following warning message. When I reload the page, the message is the error message does not show up again. Funny thing is, that there are other parts of the page generated from the same database using the same mysql_pconnect and they are fine. I am using a standard $sql mysql_query($sql) mysql_fetch_array($result) kind of command, nothing too fancy. Did anybody have a similar experince? Warning: Supplied argument is not a valid MySQL result resource in /xxx/xxx//index.php on line 45 thanks. Roman wrote: I install apache 1.3.20, php 4.0.6 and mysql on Red Hat Linux 7.0 but I must start thei manualy. I want to start this services automatically when starts the linux. How ? roman -- 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] Mehmet Erisen http://www.erisen.com - Do You Yahoo!? Make international calls for as low as $0.04/minute with Yahoo! Messenger. Mehmet Erisen http://www.erisen.com - Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: [PHP]MySQL error, what's wrong here..
try this: $query = "SELECT songname FROM mp3 WHERE sgid = \"$id\""; (or a little cleaner: $query = sprintf("SELECT songname FROM mp3 WHERE sgid = \"%d\"", $id); ) instead of: $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; - Original Message - From: "James Holloway" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 24, 2001 11:05 AM Subject: Re: [PHP]MySQL error, what's wrong here.. > Hi Chris, > > If you're using MySQL 3.23+, you might want to consider using something > like: > > SELECT songname FROM mp3 ORDER BY RAND() LIMIT 1 > > Not that this answers your original problem, but it seems to make more sense > than manually coding a random number (which is, perhaps, impractical > especiallyif you plan to add / take away entries to your table on a regular > basis). > > James > > "Chris Cocuzzo" <[EMAIL PROTECTED]> wrote in message > 014d01c113ca$dd3bf460$[EMAIL PROTECTED]">news:014d01c113ca$dd3bf460$[EMAIL PROTECTED]... > > > $id = rand(1,2); > > $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; > > $result = mysql_query($query,$connection); > > $mp3d = mysql_fetch_array($result); > > ?> > > > > the server is telling me line 43(which starts with $mp3d) is not a valid > > mysql result resource. what am i doing wrong?? > > > > chris > > > > > > -- > 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 error, what's wrong here..
Hi Chris, If you're using MySQL 3.23+, you might want to consider using something like: SELECT songname FROM mp3 ORDER BY RAND() LIMIT 1 Not that this answers your original problem, but it seems to make more sense than manually coding a random number (which is, perhaps, impractical especiallyif you plan to add / take away entries to your table on a regular basis). James "Chris Cocuzzo" <[EMAIL PROTECTED]> wrote in message 014d01c113ca$dd3bf460$[EMAIL PROTECTED]">news:014d01c113ca$dd3bf460$[EMAIL PROTECTED]... >$id = rand(1,2); > $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; > $result = mysql_query($query,$connection); > $mp3d = mysql_fetch_array($result); > ?> > > the server is telling me line 43(which starts with $mp3d) is not a valid > mysql result resource. what am i doing wrong?? > > chris > -- 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 error, what's wrong here..
my guess would be that sgid is a character field. if this isn't the case then try hardcoding a known id into the query and seeing what happens. It could also be that the connection has failed, try something like: if ($connection = mysql_connect()) { ... $id = rand(1,2); $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; if ($result = mysql_query($query,$connection)) { $mp3d = mysql_fetch_array($result); ... } else echo("query failed"); ... } else echo("connection failed"); this'll give you an idea of where it's going wrong Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -Original Message- > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] > Sent: 23 July 2001 23:57 > To: [EMAIL PROTECTED] > Subject: [PHP]MySQL error, what's wrong here.. > > >$id = rand(1,2); > $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; > $result = mysql_query($query,$connection); > $mp3d = mysql_fetch_array($result); > ?> > > the server is telling me line 43(which starts with $mp3d) is > not a valid > mysql result resource. what am i doing wrong?? > > chris > > -- 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 error, what's wrong here..
On Tue, 24 Jul 2001 14:10, Chris Cocuzzo wrote: > > - Original Message - > From: Christopher Ostmo <[EMAIL PROTECTED]> > To: Chris Cocuzzo <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Monday, July 23, 2001 10:38 PM > Subject: Re: [PHP]MySQL error, what's wrong here.. > > > Chris Cocuzzo pressed the little lettered thingies in this order... > > > > > alright, new problem, no more errors, but there's just > > > nothing...here's > > the > > > > code: > > > > > > $query = "SELECT name FROM mp3 WHERE songid = '" .$id."'"; > > > > > > http://www.fplg.net/stream.php?songid=2"; class="hov1"> > > > > Uhh... maybe I'm missing something here, but the URL supplies > > $songid and the query is getting $id. Unless your getting $id from > > somewhere other than the URL, you're going to be getting only results > > with an empty songid field. Another thing to try is to "or die" your > > query > > > to check to see if the SQL syntax is OK: > > $result=mysql_query($query,$connection) or die(mysql_error()); > > > > Good luck... > > > maybe my sql syntax is completely wrong, but the "$id" part was a > random number i generated, and then I was saying WHERE songid(which is > the database field) is equal to $id. is that the wrong way? > > the reason why it's songid in that second tag is because I wanted > the random number to indentify the song pulled from the database..so > the database uses that number in the part where it > says..."stream.php?songid= > > tell me if I need to clarify! > chris Well. if the random number created is outside the range of actual songid values that are in the database, you're not going to get any rows returned, are you? You could confirm by echoing your query and trying the same query, with the randomly generated number, in the mysql console. Or by checking the number of rows returned by your query with mysql_num_rows() Incidentally, if songid is an int type, you don't want to pass it a value in quotes; only char types need to be quoted. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA The Hubbell works fine; all that stuff IS blurry! -- 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 error, what's wrong here..
maybe my sql syntax is completely wrong, but the "$id" part was a random number i generated, and then I was saying WHERE songid(which is the database field) is equal to $id. is that the wrong way? the reason why it's songid in that second tag is because I wanted the random number to indentify the song pulled from the database..so the database uses that number in the part where it says..."stream.php?songid= tell me if I need to clarify! chris - Original Message - From: Christopher Ostmo <[EMAIL PROTECTED]> To: Chris Cocuzzo <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, July 23, 2001 10:38 PM Subject: Re: [PHP]MySQL error, what's wrong here.. > Chris Cocuzzo pressed the little lettered thingies in this order... > > > alright, new problem, no more errors, but there's just nothing...here's the > > code: > > > > $query = "SELECT name FROM mp3 WHERE songid = '" .$id."'"; > > > > http://www.fplg.net/stream.php?songid=2"; class="hov1"> > > > > Uhh... maybe I'm missing something here, but the URL supplies > $songid and the query is getting $id. Unless your getting $id from > somewhere other than the URL, you're going to be getting only results > with an empty songid field. Another thing to try is to "or die" your query > to check to see if the SQL syntax is OK: > $result=mysql_query($query,$connection) or die(mysql_error()); > > Good luck... > > Christopher Ostmo > a.k.a. [EMAIL PROTECTED] > AppIdeas.com > Innovative Application Ideas > Meeting cutting edge dynamic > web site needs since the > dawn of Internet time (1995) > > Business Applications: > http://www.AppIdeas.com/ > > Open Source Applications: > http://open.AppIdeas.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 error, what's wrong here..
Chris Cocuzzo pressed the little lettered thingies in this order... > alright, new problem, no more errors, but there's just nothing...here's the > code: > > $query = "SELECT name FROM mp3 WHERE songid = '" .$id."'"; > > http://www.fplg.net/stream.php?songid=2"; class="hov1"> > Uhh... maybe I'm missing something here, but the URL supplies $songid and the query is getting $id. Unless your getting $id from somewhere other than the URL, you're going to be getting only results with an empty songid field. Another thing to try is to "or die" your query to check to see if the SQL syntax is OK: $result=mysql_query($query,$connection) or die(mysql_error()); Good luck... Christopher Ostmo a.k.a. [EMAIL PROTECTED] AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) Business Applications: http://www.AppIdeas.com/ Open Source Applications: http://open.AppIdeas.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 error, what's wrong here..
In your code, you have the lines: -- while($mp3d = mysql_fetch_array($result)) { $mp3d = mysql_fetch_array($result); ?> -- In the while control structure, you are fetching a result into $mp3d, then inside the brackets, you fetch a second (non-existing) result into $mp3d again. Try it without the third line of that segment. james -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Monday, July 23, 2001 7:39 PM To: [EMAIL PROTECTED] Subject: Re: [PHP]MySQL error, what's wrong here.. alright, new problem, no more errors, but there's just nothing...here's the code: and here's what the HTML code looks like from the page when i test it out.. http://www.fplg.net/stream.php?songid=2"; class="hov1"> what's going on with that... chris - Original Message - From: James Bogosian <[EMAIL PROTECTED]> To: Chris Cocuzzo <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, July 23, 2001 7:25 PM Subject: RE: [PHP]MySQL error, what's wrong here.. > Try: > > $query = "SELECT songname FROM mp3 WHERE sgid = '" .$id."'"; > > an SQL query requires you to quote strings. > > james > > -Original Message----- > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 23, 2001 6:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP]MySQL error, what's wrong here.. > > >$id = rand(1,2); > $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; > $result = mysql_query($query,$connection); > $mp3d = mysql_fetch_array($result); > ?> > > the server is telling me line 43(which starts with $mp3d) is not a valid > mysql result resource. what am i doing wrong?? > > chris > > > -- > 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 error, what's wrong here..
alright, new problem, no more errors, but there's just nothing...here's the code: and here's what the HTML code looks like from the page when i test it out.. http://www.fplg.net/stream.php?songid=2"; class="hov1"> what's going on with that... chris - Original Message - From: James Bogosian <[EMAIL PROTECTED]> To: Chris Cocuzzo <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, July 23, 2001 7:25 PM Subject: RE: [PHP]MySQL error, what's wrong here.. > Try: > > $query = "SELECT songname FROM mp3 WHERE sgid = '" .$id."'"; > > an SQL query requires you to quote strings. > > james > > -Original Message- > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 23, 2001 6:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP]MySQL error, what's wrong here.. > > >$id = rand(1,2); > $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; > $result = mysql_query($query,$connection); > $mp3d = mysql_fetch_array($result); > ?> > > the server is telling me line 43(which starts with $mp3d) is not a valid > mysql result resource. what am i doing wrong?? > > chris > > > -- > 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 error, what's wrong here..
Try: $query = "SELECT songname FROM mp3 WHERE sgid = '" .$id."'"; an SQL query requires you to quote strings. james -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Monday, July 23, 2001 6:57 PM To: [EMAIL PROTECTED] Subject: [PHP]MySQL error, what's wrong here.. the server is telling me line 43(which starts with $mp3d) is not a valid mysql result resource. what am i doing wrong?? chris -- 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]MySQL error, what's wrong here..
the server is telling me line 43(which starts with $mp3d) is not a valid mysql result resource. what am i doing wrong?? chris -- 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 ERROR: Update Query Failed problem with 4.0.6
I know a lot of people are having this problem too because there is a bug report with the same/similar description for many different platforms. Here is how I got things to work. I did this with the latest php4 dev CVS snapshot (which also has the same error) but it should work on 4.0.6 also. I believe this problem is a problem with different version of the MySQL API that PHP is using. MySQL just made some changes to their API with the last couple of versions the latest 3.23.39 is what I am running and what I experienced the problem with. Build PHP with --with-mysql but DO NOT specify the path to mysql. By not specifying the path mysql will use its built-in static version of the mysql client lib. There is a warning that doing this this way will not work when using mysql-auth apache module but I use the latest version of mysql-auth and found no problems. good luck -David - Original Message - From: "David Wartell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, July 13, 2001 1:55 PM Subject: [PHP] mysql ERROR: Update Query Failed problem with 4.0.6 Im using PHP 4.0.6 install on Solaris x86 with mysql 3.23.39. The following code causes mysql_query to return false, but the database update works! $query .= "WHERE User_Name = '$User_Name[$i]'" ; $sth = mysql_query($query) or die ("ERROR: Update Query Failed$query") ; if ($verbose) { print ("$query"); } Here is the error message generated by the code: ERROR: Update Query Failed UPDATE Padmin SET Full_Name = 'Corin Cody', Admin = 1 WHERE User_Name = 'ccody' I was recieving the following warning from the code above until I changed error_reporting = E_ERROR Warning: MySQL: Unable to save result set in /usr/www/netsite-docs/parda.actionwebservices.com/public-html/includes/admin_user_write.php on line 26 Here are my PHP build options: CC=gcc OPTIM="-O2" EXTRA_LIBS=/usr/local/lib LIBS=-lz ./configure --with-apxs=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql/ --with-png-dir=/usr/local/lib/libpng.so.2 --with-i map=/usr/local/lib --with-lz=/usr/local/lib Any ideas? Thanks, David -- 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] mysql ERROR: Update Query Failed problem with 4.0.6
Im using PHP 4.0.6 install on Solaris x86 with mysql 3.23.39. The following code causes mysql_query to return false, but the database update works! $query .= "WHERE User_Name = '$User_Name[$i]'" ; $sth = mysql_query($query) or die ("ERROR: Update Query Failed$query") ; if ($verbose) { print ("$query"); } Here is the error message generated by the code: ERROR: Update Query Failed UPDATE Padmin SET Full_Name = 'Corin Cody', Admin = 1 WHERE User_Name = 'ccody' I was recieving the following warning from the code above until I changed error_reporting = E_ERROR Warning: MySQL: Unable to save result set in /usr/www/netsite-docs/parda.actionwebservices.com/public-html/includes/admin_user_write.php on line 26 Here are my PHP build options: CC=gcc OPTIM="-O2" EXTRA_LIBS=/usr/local/lib LIBS=-lz ./configure --with-apxs=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql/ --with-png-dir=/usr/local/lib/libpng.so.2 --with-i map=/usr/local/lib --with-lz=/usr/local/lib Any ideas? Thanks, David -- 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] mysql error
hi all, my script was now working for month but now suddenly get this error: The table 'SQL90cb_0' is full SELECT DISTINCT t1.id,t1.textd FROM tblEntry AS t1,tblTopic AS t2 ORDER BY t2.named,t1.textd anyone know whats the problem ? thank you andreas
Re: [PHP] mysql error, dont see why.. please help
Looks like this may be in wrong order: url = '$file_name'") ^ I think you have " ' when it should be ' " > Here is the command. > > mysql_query("UPDATE user_polls WHERE uid = '$UserName' AND type = '$type' SET > url = '$file_name'") or die(mysql_error()); > > Output > You have an error in your SQL syntax near 'WHERE uid = 'Oblivion' AND type = > 'music' SET url = 'test'' at line 1 > > This is SOOO weird. > PLEASE HELP > > - Peter > > -- > 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 error, dont see why.. please help
The SET clause has to come before WHERE clause - Russ --- Toolshed Computer Productions - Professional PHP Hosting Hosting - Dedicated Servers - Design - Programming http://www.toolshed51.com -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 22, 2001 2:04 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] mysql error, dont see why.. please help Shouldn't it be: mysql_query("UPDATE user_polls SET url = '$file_name' WHERE uid = '$UserName' AND type = '$type") or die (mysql_error()); Maybe I'm wrong. -- Tyler Longren [EMAIL PROTECTED] Currently Unemployed www.noworkfortyler.com On Tue, 22 May 2001 17:00:35 EDT [EMAIL PROTECTED] wrote: > Here is the command. > > mysql_query("UPDATE user_polls WHERE uid = '$UserName' AND type = '$type' SET > url = '$file_name'") or die(mysql_error()); > > Output > You have an error in your SQL syntax near 'WHERE uid = 'Oblivion' AND type = > 'music' SET url = 'test'' at line 1 > > This is SOOO weird. > PLEASE HELP > > - Peter > > -- > 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 error, dont see why.. please help
Shouldn't it be: mysql_query("UPDATE user_polls SET url = '$file_name' WHERE uid = '$UserName' AND type = '$type") or die (mysql_error()); Maybe I'm wrong. -- Tyler Longren [EMAIL PROTECTED] Currently Unemployed www.noworkfortyler.com On Tue, 22 May 2001 17:00:35 EDT [EMAIL PROTECTED] wrote: > Here is the command. > > mysql_query("UPDATE user_polls WHERE uid = '$UserName' AND type = '$type' SET > url = '$file_name'") or die(mysql_error()); > > Output > You have an error in your SQL syntax near 'WHERE uid = 'Oblivion' AND type = > 'music' SET url = 'test'' at line 1 > > This is SOOO weird. > PLEASE HELP > > - Peter > > -- > 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] mysql error, dont see why.. please help
Here is the command. mysql_query("UPDATE user_polls WHERE uid = '$UserName' AND type = '$type' SET url = '$file_name'") or die(mysql_error()); Output You have an error in your SQL syntax near 'WHERE uid = 'Oblivion' AND type = 'music' SET url = 'test'' at line 1 This is SOOO weird. PLEASE HELP - Peter -- 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 error code - how to debug
Ensure your database name as listed in either mysql_select_db or mysql_db_query is valid. After that, it's probably a GRANT problem. Make sure the username/password pair is correct, first of all, and check the privileges of that user. My guess is that either the DB name is incorrect, or the user does not have access to that database. -- Plutarck Should be working on something... ...but forgot what it was. <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Greetings, > > This is a mysql question, (but I'm using php with it). > > Most everything is working correctly; however, when > I hit one button I get: > Database error: cannot use database xx > MySQL Error: 0 () > Session halted. > > What should I be looking for? Is this a user/password > problem? Is this a GRANT problem? > > Any help here would be appreciated. > > Thanks! > > > > > Max Pyziur BRAMA - Gateway Ukraine > [EMAIL PROTECTED] http://www.brama.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]
[PHP] mysql error code - how to debug
Greetings, This is a mysql question, (but I'm using php with it). Most everything is working correctly; however, when I hit one button I get: Database error: cannot use database xx MySQL Error: 0 () Session halted. What should I be looking for? Is this a user/password problem? Is this a GRANT problem? Any help here would be appreciated. Thanks! Max Pyziur BRAMA - Gateway Ukraine [EMAIL PROTECTED] http://www.brama.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 error
On Fri, Feb 09, 2001 at 09:26:17AM -0200, Augusto Cesar Castoldi wrote: > - > Warning: 1 is not a MySQL result index in > /home/httpd/html/fiesc_test/fiesccontato.php3 on line 24 > Whenever you see this message, echo the sql that you are using and also echo mysql_error() so you can see what is wrong with your query. -- Jason Stechschulte [EMAIL PROTECTED] -- That wouldn't be good enough. -- Larry Wall in <[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] MySQL error
I'm receiving this error message: - Warning: 1 is not a MySQL result index in /home/httpd/html/fiesc_test/fiesccontato.php3 on line 24 From this line: --- $dados=mysql_query($sql) or die("Não Encontrados registros na Tabela 1."); - What's wrong? He could't find any data? thanks, Augusto Cesar Castoldi -- 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]