![]() |
|
#1
|
|||
|
|||
Not a Valid MySQL resultI am now getting the error:
mysql_fetch_row(): supplied argument is not a valid MySQL result resource on line 11 Warning: Cannot add header information - headers already sent by (output started at ....php:11) on line 40 I have researched many options i.e. mysql_fetch_array, etc. but I am against a wall. This same code is running on a different server, without fail, and they are exactly alike (at least on the surface, because one works and the other.... The permissions/properties for mysql are the same on both systems, but .... Here is the code for lines 9 thru 20 any suggestions? Remember I am very new, and I have ordered several manuals on this subject. Thank You. PHP Code:
|
|||
|
#2
|
||||
|
||||
|
Now I am glad I didn't post a reply in that other thread. It's the same question isn't it?
Anyway, you're right in starting a new thread, this has nothing to do with your problem earlier. I can't tell what's wrong with your code because it seems like your SQL statement is the one that's causing the error. Either the table "CartItems" or (column names) don't exist or the names are mis-spelled. Since you are using what seems to be a custom function for your db queries i.e. mysql(), you'd have to find a way to make it show you the errors, if any. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
It seems like your query is not working properly. A code of your mysql() function could be a help
|
|
#4
|
|||
|
|||
|
It is the same question, but I thought a new thread was needed as well. I appreciate you assistance, I am looking at the database, And it seems the Table & column names are present and spelled correct i.e. correct case etc... so now I am looking at possible version conflicts...
Quote:
|
|
#5
|
||||
|
||||
|
I don't believe a php 'version conflict' could result in this behaviour.
Does $DBName contain the value of a database that 1) exists and 2) your script is connected to? And it does seem the error is in your SQL query. Since you moved servers, is it possible that the database is not configured correctled, even though you just checked? Try running the "SELECT CartItemsID,Date FROM CartItems" query in PhpMyAdmin, or whatever 3dParty you're using (if any). |
|
#6
|
|||
|
|||
|
i guess in your mysql(...)-function you call the mysql_query(...)-function.
if the table is empty the query-function doesn't return a valid mysql-resource. it returns false; therefore $result contains false, but mysql_fetch_row(...) expects a valid resource, otherwise it generates an error. and that's it. you have to check $result. if it contains a valid mysql-resource you can call mysql_fetch_row(...), but if the variable contains false you couldn't call this function^^. |
|
#7
|
|||
|
|||
|
Quote:
I was able to run "SELECT CartItemsID,Date FROM CartItems" query in PhpMyAdmin with no problem. The DBname is correct as are the col. names (no mis-spells) however when I run the file, I am still getting: "Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /var/www/html/Cart/index.php on line 11" and I just don't see it... Line 11 has not changed, it must be something very simple. |
|
#8
|
|||
|
|||
More error informationI have tried several different things and finally put the following in my code, just above the line that give the error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <php> if ($row = mysql_fetch_row($res)) { return $row; } else { print (mysql_error()); } break;; </php> and I think a more descriptive error displayed: access denied for user:'@localhost" to database 'classes' which is the database I want to access. I understand, I think that this is a permissions error, but an error whom?? (remember I'm very new to this.) I have also noticed this php script requires a different page, the one that has all of the database information, the host, the username, password, and database name. |
|
#9
|
||||
|
||||
|
I've never had to add '@localhost' to any of my users.
PHP Code:
The 'database' format differs per host. For example, in my scripts I use 'mydomain_dbname'. But that's something different, I reckon. Try the user without the @localhost add-on. |
|
#10
|
||||
|
||||
|
Quote:
Sorry I am late with my reply phpnewbie. When it reports an error like access denied for user:'@localhost", it simply means that the username was not set when connecting to the database server. Your hunch is right, it might simply be an issue with the "include page" not being included after all. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 08:10 |
| Starting Mysql server problem | pjacks | MySQL / PHP Forum | 23 | 08-Sep-2004 18:23 |
| PHP, MySQL, WML | skyloon | MySQL / PHP Forum | 0 | 05-Mar-2004 08:53 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 14:54 |
| MySQL Adds Subselects, Upgrades Performance and Security | JdS | MySQL / PHP Forum | 4 | 22-Jan-2003 18:42 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The