Hello,
I am trying to display the texts that is stored in mysql in a textarea on a random basis.
here is my code:
<?php
mysql_connect("localhost", "myusername", "mypass") or die("Connection Failed");
mysql_select_db("mydatabase")or die("Connection Failed");
$query1 = ("SELECT name FROM advertising");
$result1 = @mysql_query ($query1) or die (mysql_error());
$data = mysql_fetch_assoc($result1);
while($row = mysql_fetch_array($query)){
$name = $row["name"];
}
but when I run the above code I get this error and also the textarea doesn't show anything and its blank:
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/path.../public_html/display.php on line 9
could someone please help me?
Thanks