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
36
Other forums
Function to extract email attachments using PHP IMAP
function extract_attachments($connection, $message_number) {
$attachments = array();
ME54/ME54N Conditional check for Release of PR
Hi Gurus,
My requirement is to put a check on the release of the PR with respect to the c
using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto
Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r
PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi
Blocking video streaming
Hello everyone,
I post a message here because i didn't find any solution yet.
I just finis
EXplanation help
Hey all,
I am still fairly new to PHP programming and I am trying to put together a page wher
How to disable direct access to a file
Suppose I've 2 Files. 1.php & 2.php
I don't want anybody to access 2.php directly fr
Big Problem!! Please help
Hi Guys,
Im making a website for a friend have encountered a really annoying problem. When ev
admin with my register system?
Hey i wana make it so i can make a admin level on my register system , I'm kinda new to php to im no