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
Sub-domains & calling unique content
Hello,
Is there a way use something similar to the $_GET function for a sub-domain? I to be a
article site help remaining text
Hi all hope you will be fine
I am creating a article site in this site i want to put some text on
array_map() probably obvious mistake
The code below is part of a class to escape strings, but should also accept an array, using array_ma
styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those.
SCRIPT ERROR
Here is the CONTACT FORM I made for our website:
<form id="form1" name="
How to Detect it is public_html or httpdocs?
How to check whether it is cPanel or Plesk?
If it found public_html perform <?php incl
mysql UPDATE request not working and driving me crazy!!!
Hi,
I have been stuck on this for ages.
Quite simply I am trying to update my database
big pagination problem in php
<?php
$connect = mysql_connect("localhost", "root", "")
webpage with (simple) login & mysql-db
Hi all,
What I was looking for before was a multi-user password manager, web-based! The offer
check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it