PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello
I use this simple code to try something in my Web Server (Using PHP 4.4 and mySql 4.1):
<?php
$con = mysql_connect("localhost", "username", "pass");
mysql_select_db("jv");
$query = "SELECT tema, ritmo FROM temas where ritmo='BALADA' order by tema";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_NUM)) // Line 8
{
echo "Tema : {$row[0]} " . " Ritmo : {$row[1]} <br>";
}
mysql_close($con);
?>
But I receive this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Inetpub\vhosts\prolatin.com\httpdocs\php\jv_mysql.php on line 8
The Database don't have problem. Please do you can help me what is wrong?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have another little (or big) problem: (I know this is not theme for this forum but....)
I create a Virtual directory in my Hosting Web Server but I don't know how to uploads files to this Dir. Review many info in Internet but all is about create and managing Virtuals in the IIS local (my computer) I send tickets to support in Web Hosting but only send me two links to Microsoft that don't help me for nothing. The manual of PLESK don't say nothing about the topic. I can use a FTP client like WS_FTP to upload these files?
If you know something about this, can help me? Sorry if abuse of your time....
Now I try to load the same data into a Table but the output repeat in the two colums the same field and only for the first record. No rows for the rest of records...
For example, the first record is "A la candela" and the rhythm is "Merengue". The output is
assign mysql_fetch_array($result, MYSQL_NUM) to the $row variable. If this doesn't work (because we've reached the end of the resultset), exit the while loop.
if it's true, then continue with the loop, if it's false, then it means that the value of mysql_fetch_array(...) is null or false, which in turn means we're at the end of the result set (or it was empty), and so we don't continue with the loop.