Re: Help w/ displaying return vals

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: Help w/ displaying return vals
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7507@lists.php.net to get a copy of this message
Ryan: The followoing error message: >Warning: Supplied argument is not a valid MySQL result resource means that a php function hasn't been supplied witht the correct number of arguments. Try the following: $link = mysql_connect("host","yourusername","yourpassword") or die("Died at connection."); table_name = "yourtable"; mysql_select_db("dbname"); $sql = "SELECT * FROM yourtable"; $result = mysql_query ($result, connection); $fields = mysql_num_fields($result); $rows = mysql_num_rows($result); $table = mysql_field_table($result, $i); echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>" - - EOP - - //All I've done is to give mysql_query() two arguments //Remover gaps between mysql functions anf their arguments (Which they //shouldn't have) And given mysql_connect all 3 arguments it should have to make a successful connection to your database server. (Not sure wether you missed these out simply for clarity though) Hope that all helps and makes sense!! Cheers Russ #-------------------------------------------------------# "Believe nothing - consider everything" Russ Michell Anglia Polytechnic University Webteam http://gertrude.sipu.anglia.ac.uk/webteam r.j.michell@anglia.ac.uk +44 (0)1223 363271 ext 2331 www.theruss.com #-------------------------------------------------------#

« previous php.db (#7507) next »