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] 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
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
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
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
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] 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] 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
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
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
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
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
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
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
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.
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]
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]
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]
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]
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]
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]
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]
Re: [PHP] mysql error
> mysql_select_db("jamesmc",$db); > $result = mysql_query("SELECT * FROM comment WHERE pid='$poid' ORDER by > cid desc",$db); > $comm = mysql_fetch_array($result); This is in the FAQ, I think... Better re-read that. Start using or die() a lot: mysql_select_db("jamesmc", $db) or die("Could not select db"); $result = mysql_query(...) or die(mysql_error()); By Day:|By Night: Don't miss the Zend Web Store's| There's not enough room here... Grand Opening on January 23, 2001! | Start here: http://www.zend.com| http://l-i-e.com/artists.htm -- 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]