Need help with some php code :)
Posted on
16th Feb 2014 07:03 pm by
admin
Hey! I'm quite new to this whole thing, so please don't fire me with shait on this one =D
I'm trying to learn PHP and MySQL, and atm I am trying to make a website which corresponds with a database - a database with customers.
I managed to make the page show all the customers in the database - with first- and surname.
I want each of these customers to be clickable - when you click a customer, it shows all the information about that customer which is stored in the database.
So far I have managed to make them clickable, but I don't know how to make it so that the click posts all the associated information about that customer on the page..
I can post some of the stuff I tried out with, but I'm not good with PHP (yet! =D), and therefore I got stuck quite early... but here's some of the stuff I've done so far..
Code: <?php
// Connect to the database server
$dbcnx = @mysql_connect('localhost', 'root', 'password');
if (!$dbcnx) {
exit('<p>Unable to connect to the database server at this time.</p>');
}
// Select the database
if (!@mysql_select_db('customerdb')) {
exit('<p>Unable to locate the database at this time');
}
?>
<p>Here are all the customers:</p><br />
// Request data from the database
$customers = @mysql_query('SELECT * FROM customers');
if (!$customers) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while ($row = mysql_fetch_array($customers)) {
$customerID = $row['kundeID'];
$customer_forename = $row['forename'];
$customer_surname = $row['surname'];
echo '<p>' . $customer_forename .
$customer_surname .
' <a href="' . $_SERVER['PHP_SELF'] .
'?showcustomer=' . $customerID . '">' .
'customer details</a></p>';
}
?>
Thanks!
No comments posted yet
Your Answer:
Login to answer
189
44
Other forums
Windows Authentication
I have a website which is windows authenticated.
now i want something more on this application.<
$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown
Is there a way to override built in php functions without APD?
I am trying to use the
rename_function()
override_function()
options that are built into
search query in mysql in php problem
my search query wont work, i know, that my codes are correct.please help
Code: [Select]&l
Sql and php order list script problems
Hi im having a few problems with trying to get the coding right on a orders list ive done (or trying
How to Create a Dynamic table
col1 col2 date1 date2 date3 date4..........
a b v1 v2 v3 v4
upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t
Count of reciepients in php mailer
How can i sent a mail to large no of reciepients say 10,00,00 Using PHP MAILER
single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w
Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the