dity Posted July 31, 2008 Share Posted July 31, 2008 $tuonline=mysql_query("SELECT *,DATE_FORMAT(date,'%M %d at %l:%i %p')as 'lastonline' FROM mostonline"); $tuonline=mysql_fetch_array($tuonline); If that is my code and im getting a Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ... Am I missing a table? Thanks, Quote Link to comment Share on other sites More sharing options...
Barand Posted July 31, 2008 Share Posted July 31, 2008 remove quotes from the 'lastonline' alias Quote Link to comment Share on other sites More sharing options...
dity Posted July 31, 2008 Author Share Posted July 31, 2008 I shouldve been more, specific the error is coming from line 645, which is the second line in the code I quoted. Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 31, 2008 Share Posted July 31, 2008 .. which is a result of your syntax error in the line above it. give what barand said a whirl, i'm sure you'll find the script ceases to yell at you. Quote Link to comment Share on other sites More sharing options...
dity Posted July 31, 2008 Author Share Posted July 31, 2008 no it still does.. that why i replied.. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 31, 2008 Share Posted July 31, 2008 Add this after the first line and tell us the result if (!$tuonline) echo mysql_error()); Quote Link to comment Share on other sites More sharing options...
dity Posted August 1, 2008 Author Share Posted August 1, 2008 New error after that code is Unknown column 'date' in 'field list' Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/13/d195760324/htdocs/ladder/Forums/index.php on line 646 Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 1, 2008 Share Posted August 1, 2008 The following part of your query is referencing a column named date - DATE_FORMAT(date,'%M %d at %l:%i %p') You must put in the actual column name from your table. Quote Link to comment Share on other sites More sharing options...
dity Posted August 1, 2008 Author Share Posted August 1, 2008 thanks for your replies. How do I find out what column date goes in? Does it appear to go into it's own column? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 1, 2008 Share Posted August 1, 2008 Have a look at your table definition Quote Link to comment Share on other sites More sharing options...
dity Posted August 1, 2008 Author Share Posted August 1, 2008 I know how to create tables that have been predefined, for example CREATE TABLE `ticketcontent` ( `id` int(25) NOT NULL auto_increment, `ticketid` varchar(25) NOT NULL default '', `poster` varchar(25) NOT NULL default '', `postertype` char(1) NOT NULL default '', `content` text NOT NULL, `date` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) But I am not experienced enough to understand what you mean by look at the table definition. If you mean that it says Unknown column 'date' in 'field list' are you saying that date should go in a column field list? Thanks in advance Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 1, 2008 Share Posted August 1, 2008 you're not using the ticketcontent table - you're running the query on the mostonline table. what's the definition of that table (ie. what columns are in it and what type are they)? Quote Link to comment Share on other sites More sharing options...
dity Posted August 1, 2008 Author Share Posted August 1, 2008 yea, i was using the tableconnect as an example to let you know my sql knowledge, but anyways here is a pic of the mostonline column Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 1, 2008 Share Posted August 1, 2008 .. i don't see a date column of any kind in there. that's what's throwing off your query. you're trying to run a function on a non-existing column. Quote Link to comment Share on other sites More sharing options...
dity Posted August 1, 2008 Author Share Posted August 1, 2008 and would I be correct in assuming that this is the correct code in adding date to that column ALTER TABLE mostonline ADD 'date' default null Would that be the correct query to run? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Barand Posted August 1, 2008 Share Posted August 1, 2008 or is "lastonline" an integer unix timestamp? Quote Link to comment Share on other sites More sharing options...
dity Posted August 2, 2008 Author Share Posted August 2, 2008 I'm not sure? I'm installing this script and it appears they or I missed something... thanks Quote Link to comment Share on other sites More sharing options...
Barand Posted August 2, 2008 Share Posted August 2, 2008 If it is, this should give sensible output $tuonline=mysql_query("SELECT DATE_FORMAT(FROM_UNIXTIME(lastonline),'%M %d at %l:%i %p') as lastonline FROM mostonline"); $row=mysql_fetch_array($tuonline); echo $row['lastonline']; Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 2, 2008 Share Posted August 2, 2008 I'm installing this script and it appears they or I missed something... Ignoring the fact that the script was written without any error checking, error reporting, or error recovery logic (which would earn it a C- in a programming class), you should not be having these type of problems or need to be modifying the tables if the tables have already been created. Could you provide a link to the script's site so that someone can see what should be going on. Quote Link to comment Share on other sites More sharing options...
dity Posted August 3, 2008 Author Share Posted August 3, 2008 thanks that worked, the unix thing.. how can I tell if its unix or not? Thanks for all your replys Quote Link to comment Share on other sites More sharing options...
Barand Posted August 3, 2008 Share Posted August 3, 2008 echo strtotime ('2008-08-03 12:00:00'); // --> 1217761200 if you have a number that looks like that, it's probably a unix timestamp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.