Re: Question on DB
| From: | Miles Thompson | Date: | Tue, 09 Oct 2001 23:15:29 +0000 |
| Subject: | Re: Question on DB | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13166@lists.php.net to get a copy of this message | ||
Well, if you have access to MySQL, then try your SQL statement at the console and see what is returned. If I remember correctly, from another post, it is "select * from config". That's just about the simplest query imaginable, so either config is empty or maybe doesn't exist?
You can check on how many rows are returned with mysql_num_rows.
Maybe you should post the code here, from the beginning of the page to where the errors occurred. We're really shoooting at this with a blindfold on.
Regards - Miles
At 04:34 PM 10/9/01 -0400, Viper1 wrote:
Ok it is connecting fine to db. just the error. "Miles Thompson" <milesthompson@ns.sympatico.ca> wrote in message news:5.0.2.1.0.20011009155821.026d3b30@pop1.ns.sympatico.ca... I'm not that familiar with how MySQL structures itself in Windows (assuming you are using windows, as I saw a reference to "C:". In Linux MySQL generally installs itself as follows: ../path/to/mysql Within the mysql directory these directories are found, listed horizontally to save space: bin include info lib libexec man share sql-bench var The "var" directory contains the database files (or links to them), each as a directory. Thus the var directory on my Linux box containsauction bus_today mysql testand bus_today containsadmin.ISD admin.ISM admin.frm prompt.ISD prompt.ISM prompt.frm subscriber.ISD subscriber.ISM subscriber.frmin other words, 3 files each for each of the three tables: admin, prompt and subscriber. The mysql directory contains files which hold information about mysql itself. In any case you now have something to look for. To repeat, if mysql_Connect or mysql_pconnect is not throwing any errors, then PHP is connecting to it OK. You could add this code "or die("Unable to open test.") to confirm that the connection is OK.Here's the example from the PHP web page: <?php$link = mysql_connect ("localhost", "username", "secret") or die ("Could not connect");blah, blah, blah ?> If you don't get the message after the die, then echo your SQL to the browser. It could be that a variable is mis-spelled or hasn't been initialized. Regards - Miles Thompson PS Please post to the list, cc me if you wish. At 02:21 PM 10/9/01 -0400, Viper wrote:I see a statement that calls a db of test. But I can not locate atest.sqlfile. ----- Original Message ----- From: "Miles Thompson" <milesthompson@ns.sympatico.ca> Newsgroups: php.db To: <php-db@lists.php.net> Sent: Tuesday, October 09, 2001 12:36 PM Subject: Re: [PHP-DB] Question on DBlinesThe error isn't on those lines, it's higher up in the code. Thosearefilled bytrying to use the values $return and $meta_return which would betoqueries. Search for occurences of those earlier in your code. These messages generally indicate that a SQL query failed. To debug further, echo the statements you find used in either mysql_query or mysql_db_query functions. Before those you should see mysql_connect or mysql_pconnect functionserrorconnect to the database. I would assume those are working OK as anisbynot being thrown when the script executes the queries. If you aren't familiar with PHP go to Juli Meloni's http://www.thickbook.com site and work through a couple of examples to quickly cover the basics. For exhaustive information on PHP it's http://www.php.net you turn to. And no, you don't need a .sql file. Those are usually text files readextensionMySQL to create a database, loadit with data, what have you. Thephp-list-admin@lists.php.netisn't significant. Hope this helps - Miles Thompson At 12:06 PM 10/9/01 -0400, Viper1 wrote:I have a question about a problem I am having on a mysql db. I have inherited a website from someone that I can no longer get in touch with. The website is a smaller version of Monster.com it allows user to submit a resume and search jobs online. I am having errors on it but I am not sure I have it all. Should it have a *.sql file? It has only phtml,inc files also a admin area and all the images. I am getting an error on index.phtml of: Warning: Supplied argument is not a valid MySQL result resource in C:sitessitesindex.phtml on line 7 and : Warning: Supplied argument is not a valid MySQL result resource in C:sitesdocsma.inc on line 7 line 7 of index is: $copy = mysql_fetch_array($return); line 7 of ma.inc: $meta_row = mysql_fetch_array($meta_return); Please help . Thanks.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail:-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net