Jump to content

nead coding for array


atck

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.