Jump to content

matttherat

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

About matttherat

  • Birthday 09/02/1983

Contact Methods

  • Website URL
    http://www.talkietaco.com

Profile Information

  • Gender
    Male

matttherat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi. just started a website talkietaco.com and at the momment my code selects the first row and displays it. this is all well and good but when i add a new row to the table it gos to the bottom. I want to be able to select the last row and echo it out. Any ideas? would i need to add an id row or something? Heres the code and thank you in advance for any help people can offer. <?php $con = mysql_connect("localhost","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mainbase", $con); $result = mysql_query("SELECT * FROM matteroffact"); echo "<table border='0'> <tr> <th></th> </tr>"; $row = mysql_fetch_array($result) or die(mysql_error()); echo "<tr>"; echo "<td><strong>" . $row['question']. "</strong> ". $row['answer']; "</td>"; echo "<tr>"; echo "</table>"; ?>
  2. hi. i want to echo part of my code in bold or strong. can anyone help please? echo "<table border='0'> <tr> <th></th> </tr>"; $row = mysql_fetch_array($result) or die(mysql_error()); echo "<tr>"; echo "<td>" . $row['question']. " ". $row['answer']; "</td>"; echo "<tr>"; echo "</table>"; I want to bold the $row question part. Hope someone knows. thanks
  3. YAY got it working. thank u everybody for your help. the final code was this. echo "<tr>"; echo "<td>" . $row['subject1'] . "</td>"; echo "<td>" . $row['subject2'] . "</td>"; echo "<td>" . $row['subject3'] . "</td>"; echo "<td>" . $row['subject4'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; $sum = $row['subject1'] + $row['subject2'] + $row['subject3'] + $row['subject4']; echo "<td>" . $sum . "</td>"; echo "</tr>";
  4. ah ha. its working. i left a echo in that wasnt formatted properly. the only problem now is it isnt outputting the answers in new rows each time. is reading 103138126 etc when should be 103 138 126 with each answer inline with each row. eg sub1 sub2 sub3 sub4 total 25 + 25 + 25 + 25 = 100
  5. that did nothing either. Im not sure what else to do
  6. sorry im just testing it straight online. so dont see any errors.
  7. sorry slumph. i had no luck with that code. page went blank when i added it. any other ideas?
  8. Sorry I wasn't clear. The 4 rows being echoed subject 1, subject 2, 3 and 4 are all integers. I want to add these 4 rows together and echo out the total of the 4 fields combined. the full code is here. <?php $con = mysql_connect("localhost","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mainbase", $con); $result = mysql_query("SELECT * FROM agegame"); echo "<table border='1'> <tr> <th>subject1</th> <th>subject2</th> <th>subject3</th> <th>subject4</th> <th>email</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['subject1'] . "</td>"; echo "<td>" . $row['subject2'] . "</td>"; echo "<td>" . $row['subject3'] . "</td>"; echo "<td>" . $row['subject4'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  9. Hi ive got this code which echos out all the rows from an SQL table. while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['subject1'] . "</td>"; echo "<td>" . $row['subject2'] . "</td>"; echo "<td>" . $row['subject3'] . "</td>"; echo "<td>" . $row['subject4'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "</tr>"; } echo "</table>"; All i want to do is add all the 4 subject together and echo it out. simple but not sure how to do it. any ideas please? Thanks Matt
  10. Something like the following should work for you. You may want to tweak it. $check = mysql_query("SELECT email FROM temp_members_db WHERE email = '$email'") $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { header("refresh: 5; signup_ac.php"); die('Sorry, the email <b>'. $email .'</b> is already in use.'); } Hi. thanks. that looks pretty good but not really working. It just seems to have a blank page.it is working as in it doesnt send the info to the database. Just want it so it also redirects to a new page say bla.html. any ideas?
  11. Hi. am new to php. followed a tutorial to do an email verification but it isnt set to check the db for exisiting emails. want it so only one email can be registered per person. can anyone help? If u want to see my code see attached file [attachment deleted by admin]
×
×
  • 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.