Getting my UCP to connect to the Mysql
#1

PHP код:
<?php
$con 
mysql_connect("localhost","username","password");
if(!
$con) die("Error connecting to database!");
$con mysql_select_db("database");
if(!
$con) die("Error selecting database!");
$string "SELECT * FROM `News` ORDER BY `ID` DESC";
$result mysql_query($string); 
if(!
$result)
{
    echo 
"Error reading news from MYSQL!";
    exit;
}
echo 
'<center><table width="80%"><tr><td>';
while(
$news mysql_fetch_array($result,MYSQL_ASSOC))

   echo 
'<center><br><br><br><span style="color:white"><strong><font size="5">'.$news['Title'].'</font></strong><br><br>'.$news['Text'].'</span></center><span style="color:white"><br><p align="right"><i>by '.$news['Admin'].' at '.$news['Time'].'</i></p></span><br>'

    echo 
"</td></tr></table></center>";
That is my code for my UCP as you can see it only has $con = mysql_connect("localhost","username","password") so it wont connect to the database, How can i add it so that it goes to the database i want it to?
Reply


Messages In This Thread
Getting my UCP to connect to the Mysql - by stueycow - 18.12.2013, 18:49
Re: Getting my UCP to connect to the Mysql - by Mauzen - 18.12.2013, 19:15
Re: Getting my UCP to connect to the Mysql - by stueycow - 18.12.2013, 20:48
Re: Getting my UCP to connect to the Mysql - by InfiniTy. - 18.12.2013, 21:13
Re: Getting my UCP to connect to the Mysql - by stueycow - 19.12.2013, 06:28

Forum Jump:


Users browsing this thread: 1 Guest(s)