Why dosen't this work!!!(No parse errors etc)

From: Date: Tue, 18 Jun 2002 12:48:16 +0000
Subject: Why dosen't this work!!!(No parse errors etc)
Groups: php.general 
Request: Send a blank email to php-general+get-102915@lists.php.net to get a copy of this message
I have the following code: $week = date("W"); $year = date("Y"); echo "$week<br>$year"; $query = "SELECT * FROM qoutes WHERE year <= $year AND week <= $week"; $result = mysql_query($query); $row = mysql_fetch_array($result); $num_results = mysql_num_rows($result); for ($i=0; $i <5; $i++) { $row = mysql_fetch_array($result); echo '<p>'; echo $row['qoute']; echo '</p><p align="right"><i>-- '; echo $row['author']; echo '</i></p><hr noshade>'; It returns nothing... Why? Here is a SQL dump from the table qoutes. # phpMyAdmin MySQL-Dump # http://phpwizard.net/phpMyAdmin/ # # Host: 216.89.24.247 Database : co2busters # -------------------------------------------------------- # # Table structure for table 'qoutes' # CREATE TABLE qoutes ( id int(9) unsigned NOT NULL auto_increment, week int(2) DEFAULT '0' NOT NULL, year int(4) DEFAULT '0' NOT NULL, qoute text NOT NULL, author varchar(200) NOT NULL, PRIMARY KEY (id) ); # # Dumping data for table 'qoutes' # INSERT INTO qoutes VALUES ( '1', '25', '2002', 'The supreme reality of our time is ...the vulnerability of our planet..', '- John F. Kennedy (1917-1963)<br>Thirty-fifth U.S. President<br>Speech 28, June 1963'); INSERT INTO qoutes VALUES ( '2', '26', '2002', 'Nature shows us only surfaces, but she is a million fathoms deep.', 'Ralph Waldo Emerson (1803-1882)<br>Major American Author, Philosopher &amp; Poet'); I have done this function earliar in the page(It works elsewhere so I don't believe connecting to the database is the problem, The user and password have been replaced with *'s for obvious security reasons) function co2busters_open_db(){$link = mysql_pconnect("216.89.24.247", "**********", "**********") or die("Could not connect"); mysql_select_db("co2busters") or die("Could not select database");} I hope someone could shed some light onto this. Goodnight... JJ Harrisonwebmaster@tececo.comwww.tececo.com

« previous php.general (#102915) next »