|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
please help with error...
i just did this basic mysql and php tutorial/article: http://www.devarticles.com/art/1/23/3
and got this error. I have no idea about it other than maybe a dir basic i missed....and help would be appreciated. Here is the error I got when trying to view the file: Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/essenmin/public_html/ope.php on line 4 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/essenmin/public_html/ope.php on line 5 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/essenmin/public_html/ope.php on line 6 Name: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/essenmin/public_html/ope.php on line 7 Address: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/essenmin/public_html/ope.php on line 8 Home Number: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/essenmin/public_html/ope.php on line 9 Work Number: |
|
#2
|
|||
|
|||
|
Lets see your code
__________________
Hungry for Code Programming works best with a team over one single person
|
|
#3
|
|||
|
|||
|
Just making a educated guess here, but i think your providing the wrong database details
|
|
#4
|
|||
|
|||
|
i tried two things:
where it says "essenmin_myDB" i also tried just myDb and in the printf's i tried "$result,0,... as well as $result,1 both alterations give same results <code> <html> <body> <?PHP $db = @mysql_connect("localhost", "root"); mysql_select_db("essenmin_myDb",$db); $result = mysql_query("SELECT * FROM address",$db); printf("Name: %s<br>\n", mysql_result($result,1,"name")); printf("Address: %s<br>\n", mysql_result($result,1,"address")); printf("Home Number: %s<br>\n", mysql_result($result,1,"hnum")); printf("Work Number: %s<br>\n", mysql_result($result,1,"wnum")); ?> </body> </html> </code> |
|
#5
|
|||
|
|||
|
Figured it out..."root" was wrong...needed my login info.
thanks tho, hope it didn't cause any headaches ![]() |
|
#6
|
|||
|
|||
|
please help with error...(new error)
another error i can't figure out :P help paweese...
and i dont know if it is actually line 17 do to wrapping and such on my post, but it refers to: $result = mysql_query("SELECT * FROM address",$db); if ($myrow = mysql_fetch_array($result)) { ... [error/output] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/essenmin/public_html/matt/ope.php on line 17 Sorry, no records were found! [/end output] [code] <html> <body> <?PHP $db = mysql_connect("localhost", "*****", "******"); mysql_select_db("essemin_myDb",$db); // display individual record if ($id) { $result = mysql_query("SELECT * FROM address WHERE id=$id",$db); $myrow = mysql_fetch_array($result); printf("Name: %s\n<br>", $myrow["name"]); printf("Address: %s\n<br>", $myrow["address"]); printf("Home Number: %s\n<br>", $myrow["hnum"]); printf("Work Number: %s\n<br>", $myrow["wnum"]); } else { // show employee list $result = mysql_query("SELECT * FROM address",$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf("<a href=\"%s?id=%s\">%s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["name"]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo "Sorry, no records were found!"; } } ?> </body> </html> Last edited by papasmurf : December 9th, 2002 at 12:20 AM. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > please help with error... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|