alexguz79 Posted March 24, 2009 Share Posted March 24, 2009 i'm having this on a connection to my sql db Warning: extract() [function.extract]: First argument should be an array in /home/tontrosk/public_html/pia/display.php on line 10 here is my code <?php include("db.php"); mysql_connect ($host, $user, $pass); mysql_select_db ($database); $result = mysql_query ("SELECT * FROM 'departamentos' ORDER BY id DESC LIMIT 2"); $row = @mysql_fetch_array($result); extract($row); echo "$nombre : $precio"; ?> Link to comment https://forums.phpfreaks.com/topic/150945-solved-problem-with-mysql_fetch_array/ Share on other sites More sharing options...
POG1 Posted March 24, 2009 Share Posted March 24, 2009 try changing $row = @mysql_fetch_array($result); to $row = mysql_fetch_array($result,MYSQL_ASSOC); Link to comment https://forums.phpfreaks.com/topic/150945-solved-problem-with-mysql_fetch_array/#findComment-793033 Share on other sites More sharing options...
alexguz79 Posted March 24, 2009 Author Share Posted March 24, 2009 nop... same error.... i don't know whats happening.... i'm following this video tutorial and in the video seems to work perfectly at once.... but i get this everytime Link to comment https://forums.phpfreaks.com/topic/150945-solved-problem-with-mysql_fetch_array/#findComment-793034 Share on other sites More sharing options...
revraz Posted March 24, 2009 Share Posted March 24, 2009 Remove the single quotes from around your tablename. Using mysql_error() after your querry would probably tell you the error. Link to comment https://forums.phpfreaks.com/topic/150945-solved-problem-with-mysql_fetch_array/#findComment-793081 Share on other sites More sharing options...
alexguz79 Posted March 24, 2009 Author Share Posted March 24, 2009 that worked.. thanks Link to comment https://forums.phpfreaks.com/topic/150945-solved-problem-with-mysql_fetch_array/#findComment-793102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.