Hi, Guys i'm still new with PHP & MySQL and still learning, and now i need help to fix some errors on my website, Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/d/a/v/davidau/html/CatalogList.php on line 6 Line 6 : while($row=mysql_fetch_array($result_catalog)) Please tell me what is wrong with it and help me to fix it. I hope you guys can help me to figure this out. thanks in advance. Best regards' -Me <?php $sq_catalog="Select * from sy_Catalog"; $result_catalog = mysql_query($sq_catalog); $count=0; $perRow=12; while($row=mysql_fetch_array($result_catalog)) { if(mysql_num_rows($result_catalog)>0) { if ($count<=$perRow) { $catalog = $row["Catalog"]; if ($catalog =='Home Decor') { echo "<a class='AMenu' href=index.html>" . $catalog. "</a> <font class='hLine'>|</font> "; } else if ($catalog =='Zippers') { echo "<a class='AMenu' href=pacific_zipper.php>" . $catalog. "</a> <font class='hLine'>|</font> "; } else echo "<a class='AMenu' href=ProductList.php?value=" . $catalog . "&cvalue=All>" . $catalog . "</a> <font class='hLine'>|</font> "; $count++; } if ($count==$perRow) { echo "<br>"; $count=0; } } else echo "Record not Found!!!"; } ?> PHP:
Uh...how can you have no problems connecting in your previous posted code while there's no connection setup. And also if you didn't understood, I meant you to replace $result_catalog = mysql_query($sq_catalog); with $result_catalog = mysql_query($sq_catalog) or die(mysql_error());
That would give a different error. Is this page included somewhere? Connecting and selecting a MySQL Database goes as; //Connecting to serve: server location, username, password mysql_connect("localhost","username","password"); //Selecting database: database name mysql_select_db("my_database"); PHP:
<?php $passwd = 'xxxxx'; $host = 'xxxx.xxxxx.net'; $user = 'xxxxxxx'; $link = mysql_connect("$host", "$user", "$passwd") or die("Could not connect"); mysql_select_db($link ); ?> PHP:
AWESOME!!! Thank you so much, mate!!!! I hope i can learn more from you, next time. Thanks thanks thanks!