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"; ?> Quote 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); Quote 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 Quote 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. Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.