DiscoTrio Posted December 5, 2009 Share Posted December 5, 2009 I have this working on anather page but as soon as I plug into a table I get the following warning: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bmvybfbk/public_html/displaytesting.php on line 126 Heres the code: <table cellpadding="2" cellspacing="2" width="90%"> <tr> <td> <?php $con = mysql_connect("localhost","bmvybfbk_master","74SAc194G"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("bmvybfbk_website", $con); $result3 = mysql_query("SELECT LEFT (content, 100) FROM snews WHERE id='1' ORDER BY id2 LIMIT 0, 5;SELECT * FROM snews WHERE id='1' ORDER BY id2 LIMIT 0, 5;"); while($row3 = mysql_fetch_array($result3)) { echo $row['content']; } ?> </td> <td> 2 </td> </tr> <tr> <td> 3 </td> <td> 4 </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/ Share on other sites More sharing options...
mrMarcus Posted December 5, 2009 Share Posted December 5, 2009 it doesn't. it thinks you query is bad. add: or trigger_error (mysql_error()); to the end of your query and rerun. Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972021 Share on other sites More sharing options...
DiscoTrio Posted December 5, 2009 Author Share Posted December 5, 2009 K when added inside the query nothing changes, on very end of line I get this: Parse error: syntax error, unexpected T_LOGICAL_OR in /home/bmvybfbk/public_html/displaytesting.php on line 124 By the way line 124 is: query line and 126 is one with while($row3 = mysql_fetch_array($result3)) Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972023 Share on other sites More sharing options...
DiscoTrio Posted December 5, 2009 Author Share Posted December 5, 2009 O ya, and I ran the quey in PHPMYADMIN many times and it works how I want it to. Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972024 Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2009 Share Posted December 5, 2009 I don't think you can run multiple queries with mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972026 Share on other sites More sharing options...
DiscoTrio Posted December 5, 2009 Author Share Posted December 5, 2009 Really? It works on datasbe when I do it in phpMYAdmin.... Well how could I do this anather way and still aciev seeing only 3 results, 100charecters of content, and the rest of tables normally...? Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972032 Share on other sites More sharing options...
PFMaBiSmAd Posted December 5, 2009 Share Posted December 5, 2009 For the queries you posted, there is no need to execute two different queries - SELECT *, LEFT(content, 100) AS short_version FROM snews WHERE id='1' ORDER BY id2 LIMIT 0, 5 Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972035 Share on other sites More sharing options...
DiscoTrio Posted December 5, 2009 Author Share Posted December 5, 2009 Wow, finally getting something. Thanx, but what is AS short_version for? And the number of charecters dont seem to be limited... Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972039 Share on other sites More sharing options...
DiscoTrio Posted December 5, 2009 Author Share Posted December 5, 2009 ooooo, nvm, thanx! *solved* Quote Link to comment https://forums.phpfreaks.com/topic/184111-why-does-php-think-mysql_fetch_array-is-bad/#findComment-972041 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.