Jump to content

distant

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

distant's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for replying corrupshun. I can't use hover, as the color must be there the whole time (the color doesn't matter for now, I just want to learn how to do it). I'm also pulling the data from a mysql database so I cannot address the rows directly. I wish I could figure how to do this in php.
  2. Thank you premisso! One last thing. Been surfing the web without luck for the last few hours. What's the best method to alternate the row colors for better legibility? Thanks once again.
  3. Wrong code. This is the right one: <?php include('connect.php'); mysql_select_db("gracom1_widgets", $con) or die(mysql_error()); $result = mysql_query("SELECT * FROM customers INNER JOIN states on states.stateID = customers.stateID") or die(mysql_error()); echo "<table width='600px'> <tr> <th>Customer Name</th> <th>Phone</th> <th>Email</th> <th>Address</th> <th>State</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . $row['custName'] . "</td>"; echo "<td>" . $row['custPhone'] . "</td>"; echo '<td><a href="mailto:' . $row['custEmail'] . '?subject=">' . $row['custEmail'] . "</a></td>"; echo "<td>" . $row['custAddress'] . "</td>"; echo "<td>" . $row['stateName'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  4. Wow thanks premisso you rule! One last thing. How can I make it so it shows only the selected row (and not the whole table)? I know it has something to do with the $_GET Function in the URL as I've been reading. Just can't seem to figure it out. Can't thank you enough. <?php include('connect.php'); mysql_select_db("gracom1_widgets", $con) or die(mysql_error()); $result = mysql_query("SELECT `custName`, custPhone, custEmail, custID FROM customers") or die(mysql_error()); echo "<table width='600px'> <tr> <th>Customer Name</th> <th>Phone</th> <th>Email</th> <th>Details</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . $row['custName'] . "</td>"; echo "<td>" . $row['custPhone'] . "</td>"; echo '<td><a href="mailto:' . $row['custEmail'] . '?subject=">' . $row['custEmail'] . "</a></td>"; echo '<td><a href="details.php?custID=' . $row['custID'] . '">Show</a></td>'; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  5. Thanks premisso! You're helping me a lot. Yes, the mysql_connect part you posted is housed inside of connect.php. The table is working. However, been struggling with this evil thing but can't seem to figure out how to link the "Show" in the 4th column to another php page (that will have a small table with the details of each individual customer)? And also how can I link the email in the third column to outlook (having the address on the "To" space in Outlook)? I would really appreciate some help... This is what I got so far: <?php $con = mysql_connect("localhost","gracom1_student","gra2143!"); if (!$con) { die('Could not connect: ' . mysql_error()); } ?> <?php include('connect.php'); mysql_select_db("gracom1_widgets", $con) or die(mysql_error()); $result = mysql_query("SELECT `custName`, custPhone, custEmail, custID FROM customers") or die(mysql_error()); echo "<table width='600px'> <tr> <th>Customer Name</td> <th>Phone</td> <th>Email</td> <th>Details</td> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . $row['custName'] . "</td>"; echo "<td>" . $row['custPhone'] . "</td>"; echo "<td>" . $row['custEmail'] . "</td>"; echo "<td>Show</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  6. Thanks for replying premisso. I just did that bu still no data in my table other than the th tags
  7. I'm having a real hard time constructing a table that pulls out the data from the database. Can anyone help please? This is what I got: <?php $con = mysql_connect("localhost","gracom1_student","gra2143!"); if (!$con) { die('Could not connect: ' . mysql_error()); } ?> <?php include('connect.php'); mysql_select_db("gracom1_widgets", $con) or die(mysql_error()); $result = mysql_query("SELECT * FROM customers") or die(mysql_error()); mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM customers"); echo "<table width='600px'> <tr> <th>Customer Name</td> <th>Phone</td> <th>Email</td> <th>Details</td> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Customer Name'] . "</td>"; echo "<td>" . $row['Phone'] . "</td>"; echo "<td>" . $row['Email'] . "</td>"; echo "<td>" . $row['Details'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  8. Thank you so much, guys! You rock!
  9. this is what I got and I want the username and pass to stay in the flield once i submit it. $message = "<p>Please enter your login information below:</p>" ; $tempUsername = ($_POST["username"]) ; $tempPass = ($_POST["password"]) ; $congrats = "<span class='stylesheet'><p>Congrats, you successfully logged in.<p/></span>" ; $sorry = "<span class='style1'><p>Sorry, your username and password combo was not correct, please try again.</p></span>" ; if (isset($_POST ['submit'])) { if($tempUsername == "Michael") { echo $congrats ; } elseif($tempPass == "pass") { echo $Congrats ; } else echo $sorry ; } else echo $message ; <form id="form1" name="form1" method="post" action="login.php"> <p> <label for="username">Username:</label><br /> <input type="text" name="username" id="username" value="" /> </p> <p> <label for="password">Password:</label><br /> <input type="text" name="password" id="password" value="" /> </p> <p><input name="submit" type="submit" /></p> </form>
  10. Thanks for replying mraza I mean keeping an username and password on the field of the form once I click submit. Hope that's clear.
  11. How can I keep whatever I write in the form?
  12. That's awesome. You're good at this. The result is exactly this one. However, I need to incorporate a function and have the for loop calling it. Otherwise the loop goes directly to the array, isn't that so? Can't thank you enough.
  13. premisso, the thing is that i can't seem to figure out hot to get the number (1) and state name (Alabama) to change with the words (The number) and (state alphabetically is:) in between. I can only get them if their following one another. I need the function to write "The number 1 state alphabetically is: Alabama" So that I can start working on the for loop and get "The number 2 state alphabetically is: Alaska" and so forth. Am I making myself clear? Yes I'm taking this class as an elective. I appreciate you helping me!
  14. Thanks dbillings I think I've tried that too before but it doesn't allow the $state[] in the scope of the function it says "Parse error: syntax error, unexpected '[', expecting ')'" But thanks anyway
  15. Thanks for responding, premiso I've been reading php for days. My eyes hurt. What I need to do is have the numbers and states changed while everything remains the same. So should I just write $state in the the scope of the function. What do I call an index? Can you point me in a good direction? I've been reading w3schools and they're very vague. Also my time is running out...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.