atck Posted November 25, 2006 Share Posted November 25, 2006 can give me coding for array...i use this code [code]while($row = mysql_fetch_array ($result))[/code]but have error in my browser..this is error...[code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-8\www[/code]can you help me... Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/ Share on other sites More sharing options...
Stooney Posted November 25, 2006 Share Posted November 25, 2006 $result would have to come from a mysql query ex:[code]$result=@mysql_query("select * from table");[/code]then while($row = mysql_fetch_array ($result)) would be valid.Also the query has to be successful. Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/#findComment-129923 Share on other sites More sharing options...
atck Posted November 25, 2006 Author Share Posted November 25, 2006 can you continue my code...and add your code in my coding.. plz.. Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/#findComment-129925 Share on other sites More sharing options...
Stooney Posted November 25, 2006 Share Posted November 25, 2006 [url=http://www.phpfreaks.com/forums/index.php/board,8.0.html]http://www.phpfreaks.com/forums/index.php/board,8.0.html[/url] Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/#findComment-129927 Share on other sites More sharing options...
sylesia Posted November 25, 2006 Share Posted November 25, 2006 Not positive about the while loop part since you have to put in the info you want it to do, but you have to make sure you have the four lines before it to access the whole DB, and when you do, what you do with it $conn = mysql_connect("sqlLocation", "userName", "password"); mysql_select_db("DBName", $conn); $sql ="SELECT * FROM table"; $result = mysql_query($sql, $conn); while($row = mysql_fetch_array ($result)) Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/#findComment-129928 Share on other sites More sharing options...
atck Posted November 25, 2006 Author Share Posted November 25, 2006 why must put username and password?.. Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/#findComment-129929 Share on other sites More sharing options...
sylesia Posted November 25, 2006 Share Posted November 25, 2006 its to access the DB. if there is not a user name or pwd, it would look like$conn = mysql_connect("sqlLocation", "", "");so, you only put the username and password there if you actually have one for the DB, for example, if my username for one of my DB is me, and pwd is pwd, so mine looks like$conn = mysql_connect("sqlLocation", "me", "pwd"); Link to comment https://forums.phpfreaks.com/topic/28399-nead-coding-for-array/#findComment-129938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.