You are here: Re: php question. Pls take a look and see if you can help « PHP Programming Language « IT news, forums, messages
Re: php question. Pls take a look and see if you can help

Posted by needaticker on 11/21/03 11:26

This pretty much does what I need it to but it adds some code in the
result. (I mean instead of just showing the "random entry", it shows
"Array ( [field] => random entry )". It would be great if I could get
rid of all the other stuff. Here's my code so far. Can anyone tidy up
my result to get it to do what I want it to?

Thanks

<?php
$username="username";
$password="password";
$database="database";

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$randgetq=mysql_query("SELECT * FROM tablename ORDER BY RAND() LIMIT
1");

if (!$randgetresults=mysql_fetch_array($randgetq, MYSQL_ASSOC))
{
echo "Sorry no entries";
}
else
{
print_r($randgetresults);
}
mysql_close();
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация