Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

mySQL not displaying Data!?

Codes here !

Moderators: macek, egami, gesf

mySQL not displaying Data!?

Postby php-punk » Thu Mar 13, 2003 12:27 pm

well, so far i got this script:

Code: Select all

<?PHP
//connecting to the database with host, user and pwd
$Connect=mysql_connect(localhost,***,***) or die("Sorry, unable to connect to DataBase(1)");

//selecting DB to get info from
$DB=mysql_select_db(***,$connect);

$query="select * FROM news";

// executing the query
$result=mysql_query($query) or die ("sorry unable to connect to DB(2)".mysql_error());

//putting results into a array then looping thru and echoing the array
$returned=mysql_num_rows($result);
if($returned>1)
{
   while($row=mysql_fetch_array($result));
   {
   echo("&");
   echo("<table  border=\"0\" celpadding=\"1\" cellspacing=\"1\">");
   echo("<tr>");
   echo("<td><P>------------------------------------------------------------------------------------------------</P>");
   echo("".$row["Date"]);
   echo("</td>");
   echo("</tr");
   echo("<tr>");
   echo("<td>");
   echo($row['News']);
   echo("</td>");
   echo("<P>------------------------------------------------------------------------------------------------</P>");
   echo("</tr>");
   echo("</table>");
   }
}else if($returned<1)
{
echo("Sorry No News Posted");
}
?>


rite this is for a news area that i am going to be able to update via a from, it is eventually going to be a news board weer users can post!! could n e 1 help with this!?
php-punk
New php-forum User
New php-forum User
 
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Postby Romantik » Thu Mar 13, 2003 11:04 pm

Show us structure of news table in your base[/b]
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson

Postby Romantik » Thu Mar 13, 2003 11:09 pm

$Connect=mysql_connect
and
$DB=mysql_select_db(***,$connect);

different first letter ;)
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson


Return to mySQL & php coding

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.