Jump to content


Simple PHP Question

  • Please log in to reply
2 replies to this topic

#1 koolgirl

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 01 April 2006 - 07:55 PM

Hi Guys
2nd forum again posting because the 1st time is still not un-answered. Please Help
I have 2 questions, I am sure that the person who can answer one of them will be able to answer the second too.
1. I use Dreamweaver to play around with my site and learn more. Everything goes good the only thing that I am still not able to solve is the Draw layer. I want to draw a layer that will keep its position on all resolution just like the rest of the site and tables etc. But for example if I draw a layer at the left of the page which contains all the home/bla bla bla buttons. I position it as:
<div id="Layer1" style="position:absolute; left:12px; top:33px; width:135px; height:255px; z-index:1"></div>
When I preview the page, it will not show exactly where I wanted it to be. Anyway after repositioning it little by little a few times, I get the result that I want. By as soon as I change the screen resolution, it displays again somewhere else. How can I make the layer keep its position just like a table would stay where it is?
2. I got MySQL installed on webserver. Am learning PHP now. I got a sample Database, containing, ID/Name/Email/Ph# fields. I can view the names of my contacts with my sample.php which contains the following code:
$dbcnx = @mysql_connect("xxxxx",
"xxxxx", "xxxxx");
if (!$dbcnx) {
echo( "
Unable to connect to the " .
"database server at this time.</P>" );
if (! @mysql_select_db("contacts") ) {
echo( "

Unable to locate the Database" .
"database at this time.</P>" );

Here are all the contacts in our database: </P>
$result = mysql_query(
"SELECT Name FROM contacts");
if (!$result) {

Error performing query: " .
mysql_error() . "</P>");
while ( $row = mysql_fetch_array($result) ) {

" . $row["Name"] . "</P>");
This shows me the names of all the contacts in rows. I want to display not just names, but also the remaining fields and want to be able to display them in a table with borders possibly different colors for different columns. How can I do it? PLEASE help me fast. Thanks in Advance!

#2 play_

  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 01 April 2006 - 08:07 PM

1) I don't recommend doing any design on a WYSIWYG (what you see is what you get) program. Buy a CSS book, it'll help you alot more.

sample.php is displaying the names because of this:

so, to display the other ones:


I also recommend buying a phpbook. youll get a much better understanding. I say this because once you get it to work, there are a million other things you will want to do, like align the results, display each row in different colors, format the strings, purify data, etc....Which if you had a bookf or, it'd be a quick reference, instead of having to rely on others to post code for you.

regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#3 koolgirl

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 01 April 2006 - 08:45 PM

Hi Guru,

Thanks for your prompt reply. I actually have a PHP and MySQL book. Just started with it yesterday and it really did a good job as I came so far just in a day. The problem is that in my book making the tables and text in PHP is explained but not explained as how I can put data from database into the cells of PHP tables seperately. Will sure find a better book in the next days. Am not really relying just on somebody's codes but I think Forums are made for help. I found out how to get the remaining fields also during the time that I was waiting for a reply and after reading your post it was confirmed where the problem was.

Many Thanks!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users