Jump to content

mysql_fetch_array(): supplied argument is not a valid..


princess

Recommended Posts

hey another question from me.. still working on the guestbook thing, but started over with a new one, problems i dont understand came on my way..

 

please can you look at this and explain the mistake to me? i really dont see whats wrong.

 

This is the warning i receive while i test it:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:FoxServwwwtestguestbookindex.php on line 19

 

this is my code:

 

<?

$db = mysql_connect(\"lxxx\",\"xxx\",\"xxx\");

mysql_select_db (\"testgastenboek\", $db);

 

$sql = \'SELECT * FROM `testgastenboek`;\';

$result = mysql_query($sql,$db);

 

while ( $myrow = mysql_fetch_array($result) )

{

echo \"<b>Name:</b>\";echo \"<br>\";

echo $myrow[name];

echo \"<br>\";

echo \"<b> Email:</b>\";

echo \"<br>\";

echo \"<a href=\"mailto:\";

echo $myrow;

echo \"\">\";

echo $myrow;

echo \"</a>\";

echo \"<br>\";

echo \"<b> Homepage:</b>\";

echo \"<br>\";

echo \"<a href=\"\";

echo $myrow;

echo \"\">\";

echo $myrow;

echo \"</a>\";

echo \"<br>\";

echo \"<b>Comment:</b>\";

echo \"<br>\";

echo $myrow[comment];

echo \"<br>\";

echo \"<br>\";

echo \"<a href=changeform.php?id=$myrow[id]>[change]</a>\";

echo \"&nbsp\";

echo \"<a href=changeform.php?id=$myrow[id]>[delete]</a>\";

echo \"<hr noshadow width=\"300\" align=\"left\" color=\"#FF6600\">\";

}

?>

 

 

i hope this is enough information..

 

thanks in advance, Princess

Link to comment
Share on other sites

the error means that the query never executed, therefore it has nothing to be identified with. this means there is a problem with any of these: (a) the database connection; (B) choosing a database; © running the query

 

i think this extra \';\' here is the problem:

$sql = \'SELECT * FROM `testgastenboek`;\';

semicolons are not needed to end a query when using php, opposed to the mysql command line.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 years later...

progli@progli.awardspace.com here my data show 'tt' but other server side not work Why ? Please solve and mail me: munnabd_02@yahoo.com

 

<?php

//if you view 'tt' mail me(munnabd_02@yahoo.com)

$cnn=mysql_connect('db1.awardspace.com', 'progli_progli', '8013731')

or die ("Cannot connect to MySQL server: " . mysql_error());

mysql_select_db('progli_progli')

or die ("Cannot connect to db: " . mysql_error());

$result=mysql_query("select *from user");

$row=mysql_fetch_row($result);

echo $row[1];

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.