Page 2 of 2

Re: random quote php mysql

Posted: Tue Apr 07, 2009 7:16 am
by gwolff2005
OK. However I still don't get it... so what do I have to change now, to get the error away... Did you have the time to look in myphp? I changed it now back so I have the "old" mistake there... http://www.guntmarwolff.com/indexmain.php.

Ok.. now I deleted the row
while ($row = mysql_fetch_array($result)) {

now mistake comes up but as well no entry :banghead:

What is to do?

THOUSAND THANKS!!!!!!!!!!!!!!

Re: random quote php mysql

Posted: Tue Apr 07, 2009 8:16 am
by papa
Hi,

I don't need to login to your admin panel. I can see that the table does not exist from the image your posted. :)

Re: random quote php mysql

Posted: Tue Apr 07, 2009 8:17 am
by gwolff2005
I GOT IT!!!

I wrote the following code

<?php require_once('Connections/Login.php'); ?>
<?php
mysql_select_db($database_Login, $Login);
$query_Recordset1 = "SELECT quotes.quote FROM quotes";
$Recordset1 = mysql_query($query_Recordset1, $Login) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

<?php
$user="guntmar";
$password="je20sa05";
$database="guntmar";
$connection=mysql_connect('localhost',$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT `quote`, `author` FROM `quotes` ORDER by rand() LIMIT 1";
$result=mysql_query($query) or die(mysql_error());
$quote = htmlentities(mysql_result($result,$i,"quote"));
$author = htmlentities(mysql_result($result,$i,"author"));
echo("<blockquote>" . $quote . "</cite></blockquote>");
mysql_close($connection);

mysql_free_result($Recordset1);
?>