Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Change <?php print "<td width='33%' valign='top'> <table border=0 cellpadding=2 cellspacing=0 width=100%> <Tr> <Td valign=middle align=center><img src='/images/pets/$species.png' alt="$petName"></td> <td valign=top class=other width=100%>$user adopted a $species<br> Name: $petName<br>Status: $s<br>Born: $date<br>Points: $points</td> </tr> </table> </td>"; To <?php print "<td width='33%' valign='top'> <table border=0 cellpadding=2 cellspacing=0 width=100%> <Tr> <Td valign=middle align=center><img src='/images/pets/$species.png' alt=\"$petName\"></td> <td valign=top class=other width=100%>$user adopted a $species<br> Name: $petName<br>Status: $s<br>Born: $date<br>Points: $points</td> </tr> </table> </td>"; You can't have double quotes within double quotes without escaping them.
  2. Something is needed to store the value in, so thats why the alias is there. Otherwise, what would you use to output the result? If you used $row['users_pageviewd'] it wouldn't make sense, because you didn't select that row from the database in the query. Thats the best I can explain it...hopefully it makes sense
  3. You code should be: <?php $tallypageviews = mysql_query("SELECT SUM(users_pagesviewed) as total FROM users"); $row = mysql_fetch_assoc($tallypageviews); echo 'Pages Viewed By All Members: '; echo $row['total'];
  4. There is a much easier way. SELECT SUM(PagesViewed) as total FROM tableName
  5. The code I posted is exactly what you need to do. Just add the first line, and replace your current query with the second line.
  6. You never define $username before you do your query to check if it's already taken. Instead you use the variable $user which is defined for your database connection. <?php $username = $_POST['username']; $querycheck = "SELECT username FROM users WHERE username = '$username'";
  7. Why not just put an auto-increment field in the table? To get the max value +1 you would do this: SELECT MAX(field)+1 AS highest FROM table
  8. If you look at the site and KNOW how to do each script, then you are ready. If you don't know exactly what to do for something, then keep reading tutorials. www.tizag.com is a good site.
  9. the textarea tag doesn't have a value attribute, you would do this: echo "<textarea>$value</textarea>";
  10. What is wrong with the output URL? Wouldn't "u" be the persons username they want to request to be friends with, or is that the logged in users username? If it's the logged in users, then why don't you just pass the other users username through the URL as well? Make the link like this: http://example.com/main/friendrequest.php?user=u&request_freind=some_username
  11. You need to use two equal signs, not one.
  12. What is the problem? You pretty much have the link setup correctly. echo "<a href='friendrequest.php?user=$user[profileusername]'>Add as Friend</a>"."<br>"; If $user holds the username you want, I don't understand the problem.
  13. Try this: <?php include inventory.php; $username = $_POST['username']; # Main connection information $db_host='localhost'; $db_database='#########'; $db_username='#######'; $db_password='#########'; $db_config = 'mysql'; /* I am building the query here, using the $selectedname variable that the user gets stored to in inventory.php */ $connection = mysql_connect($db_host,$db_username,$db_password); if (!$connection) { die ("Could not connect to database using supplied credentials"); } $db_select = mysql_select_db($db_database); if (!$db_select) { die ("Could not select database"); } $getphoneinfo = "SELECT * FROM inventory WHERE name = '".$selectedname."'"; if (!$getphoneinfo) { die ("Could not query database"); } $phone_query = mysql_query($getphoneinfo); if (!$phone_query) { die (mysql_error() . "<p>With Query:<br>$getponeinfo"); } $phone_fetch = mysql_fetch_assoc($phone_query); $number_phone = mysql_num_rows($phone_query); echo ' <html> <head> <title>Dover Chemical Cellphone Inventory System</title> </head> <body> <!-- create a table for the header banner --> <table bgcolor="00619e" height="150" width="100%"> <tr> <td align="center"><font color="white" size="+24">Dover Chemical Cellphone Inventory</font></td> </tr> <!-- close banner table --> </table> <hr width=50%></hr> <center> <table> <tr> <td><p> Account Number: <b>######### </b>| Password: <b>##########</b> | Call : <b>##############</b></p></td> </tr> </table> </center> <hr width=50%></hr> <!-- I stole this code from the dover website for whitespace, editing the table for height. Thanks Mr. Harr!!!! --> <table height="16%"> <tr> <td> <font color=#ffffff> --------- --------- --------- --------- --------- --------- --------- --------- </font> </td> </tr> </table> <!-- center it all up in one fell swoop! --> <div align="center"> <!-- now we need a table to place the form in --> <table> /* this part works, I just post in the selected user from the inventory.php page */ <!-- form used to select the appropriate user --> <label>Selected User: '; echo $username; echo '</label> <!-- done with the form piece --> <!-- now we close the container --> </table>'; echo ' <!-- now we need a table to put the various information about the users phone --> <br /> <br /> <table align="center" width="30%" height="20%"> <tr> <td>Cellphone model</td><td>'; echo $phone_fetch['model']; echo '</td> </tr> <tr> <td>Cellphone number</td><td>'; echo "blank" ; echo '</td> </tr> <tr> <td>IMEI number</td><td>'; echo "blank"; echo '</td> </tr> <tr> <td>SIM number</td><td>'; echo "blank"; echo '</td> </tr> <!-- close information table --> </table> </div> <!-- poor mans whitespace, not as cool as brians --> <br /> <br /> <br /> <!-- Copyright mumbo-jumbo...gotta cover your ass now adays --> <center><font size="-14" face="papyrus">Copyright © 2008 Dover Chemical Corporation</font></center> </body> </html> '; mysql_close(); ?>
  14. I don't see any comments that show the problem. You also never specify the exact problem. Is the query not returning any results?
  15. <?php foreach ($_SESSION as $key => $val){ echo "$key - $val <br />"; }
  16. Nope, the site won't work.
  17. No, "time" is not a reserved word. Have you tried printing out the query? Change echo "<p>There was a problem updating the developer.</p>",mysql_error(),"<br />"; To echo "<p>There was a problem updating the developer.</p>",mysql_error(),"<br />$query";
  18. <?php if (isset($_SESSION['login'])){ print<<<HERE ALL HTML CODE GOES HERE HERE; } else { header("Location: login.php"); } ?>
  19. I would store the drug_id in the checkbox array. So change your checkbox creation line to: echo "<input type='checkbox' name='ticked[]' value='{$row['drug_id']}'>"; Then at the top of your page, you can do this to see what has been checked: <?php if (isset($_POST['ticked'])){ echo "The following drugs were chosen:<p>"; foreach ($_POST['ticked'] as $drugID){ echo $drugID.'<br>'; } } ?>
  20. Try to catch the error with a die statement, also try taking the quotes from around "Clients". mysql_query("INSERT INTO Clients (ID, FName, LName, PHON) VALUES ('NULL', '$FName', '$LName', '$PHON'")or die(mysql_error());
  21. It should look something like this: <?php if (isset($_POST['submit'])){ $choice = $_POST['choice']; echo "The user selected <b>$choice</b><p>"; } $query = mysql_query("SELECT * FROM TABLE"); echo '<form>'; while ($row = mysql_fetch_assoc($query)){ echo "<input type='radio' name='choice' value='{$row['unique_col']}'><br>"; } echo '<input type="submit" name="submit">'; echo '</form>'; ?>
  22. Okay, here is a tutorial that breaks it down for you: http://www.tizag.com/mysqlTutorial/mysqltables.php
  23. This page should explain everything: http://dev.mysql.com/doc/refman/5.0/en/create-table.html
  24. I'm sure it's possible, I'm just not exactly sure exactly what you mean when you say "bullet form".
×
×
  • 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.