Problem with DB connection


Posted on 16th Feb 2014 07:03 pm by admin

Hello there! I'm new to this forum and I'm new to PHP coding also. I wrote something that doesn't make exactly what I thought it will. Can you give me a hand please. There we go:
Code: [Select] <?php
error_reporting(E_ALL);

$Host = "***";
$User = "***";
$PassWord = "****";
$DataBaseName = "***";
$TableName = "products";

mysql_connect($Host, $User, $PassWord);
mysql_select_db($DataBaseName);

if (isset($_GET['id'])) {
$id = (int)$_GET['id'];
// $select = "SELECT id FROM" . $TableName;
if ($id > 0) {

$select = "select description from" . $TableName . "WHERE id = " . $id;
$result = mysql_query($select);
echo $result;
echo $id;
}

else {
echo "id not > 0";

}
}
else {
echo "ID not set;
}
?>
<p><a href="proba.php?id=1" name="id=1"> Find out more about it. </a></p>
<a href="proba.php?id=2" name="id=2"> Find out more about it. </a></p>
<a href="proba.php?id=3" name="id=3"> Find out more about it. </a></p>
That's a testing page only. What happens here is that only the ID is displayed.
The funny thing is when i add this code to the original page, my apache gives errors on the localhost and i get Quote Premature end of script headers. Obviously I'm doing something wrong, but I don't know what it is. oh, when i run this code on the original page but remove the password, apache is not shoting..

237 Like 36 Dislike
Previous php-forum Next php-forum
Other php-forum

user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to

Help with form post data and arrays
Hi all,

I am new to this forum... It has been awhile since i have worked with arrays, and i a

value not going in data base
hello friends....
i am having a working javascript....when i am selecting any

Functions Not Loading Into Div
I had some help doing some of this but what I'm trying to do is get my functions to retrieve its val

regex for quoted text within a string
I am still getting the hang of regex expressions, but I cant seem to figure out how I would escape q

Last Weeks sDate and eDate.
sDate - Start Date
eDate - End Date

I need to pull two dates for "Last Week" whi

Spaghetti Code
So.

I've pretty much reached the point where I have so many isset s on one page that I can't

Save file by click
Hello.
I'm not understand how to save file from page. I'd like make link to file with save abil

PHP Code To Change Font Color in Table Cell
I would appreciate help with the following snippet of my php code. I am just trying to change the f

Find only certain URLs from page ... regex (semi-complete script)
Hi guys,

What I need to do is take a page & extract all the URLs from the page &a

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash