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..

No comments posted yet

Your Answer:

Login to answer
237 Like 36 Dislike
Previous forums Next forums
Other forums

License Issue - service type user
Hi,

I would like to understand the following issue regarding sap license.
I wish to

Edit MySQL Row Using PHP and HTML Form
Hello,

Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.

Preventing blank or already entered values
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLAN

Help uploading .JPG
I have a problem with upload images when the ending is .JPG capitalized.. I really don't know what c

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

Convert .fdf to .pdf
I currently have a web form that uploads the form data to an .fdf file and emails it.

However

Map.php
I am a complete beginner to PHP and am looking for some help with a program I am messing around with

duplicate record notification
In my database, after insertion of records, I want to know if the record inserted is duplicate or no

MySQL-PHP Query Results Help
Hello all. I'm hoping to be able to get some help in solving a problem with query/rowcount output. I

Need help with simple code, back and forward buttons.
Basically, I have a set of pages in a folder, which have the title somephrasehere_09.php, somephrase

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