Jump to content

obsidian

Staff Alumni
  • Posts

    3,202
  • Joined

  • Last visited

Everything posted by obsidian

  1. like lexnaturalis said, you've got to use the mail() function to get the mail to send. he was simply showing you how to pull the address to use in the mail function. click on the function above to view the php manual page corresponding to this great function. good luck!
  2. Well, with this year's E3 well underway, I wanted to get some opinions of those in the computer industry on how they think the specs of the next generation of gaming are shaping up. At first glance, XBox 360 promises to be the first one off the blocks with a release of Halo 3 the day Playstation 3 is released, however, Sony promises to support more connectivity out of the box, including up to 7 wireless bluetooth controllers for a total of 8 players simultaneously. Then we have the Revolution that defines the topic of backward-compatability allowing users not only to play gamecube discs, but also to download "fan-favorites" from every Nintendo console all the way back to the NES to play... the question I pose is easy: AT FIRST GLANCE, WHICH SYSTEM DO YOU THINK WILL DOMINATE, AND WHY??? Enjoy!
  3. that's extremely vague... there are so many aspects and directions you can take even a simple CMS... what type of data will you be needing to control? give us an idea of what your simple cms is going to handle, and we'll be able to help much more efficiently.
  4. if you are looping through your results to list the items and prices, just add each price to the total as you list it: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php $total [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$result [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"SELECT * FROM shopping_cart\"[/span][span style=\"color:#007700\"]); while ([/span][span style=\"color:#0000BB\"]$row [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$result[/span][span style=\"color:#007700\"])) { echo [/span][span style=\"color:#DD0000\"]\"$row[item] - $row[price]<br />\n\"[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$total [/span][span style=\"color:#007700\"]+= [/span][span style=\"color:#0000BB\"]$row[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'price\'[/span][span style=\"color:#007700\"]]; } echo [/span][span style=\"color:#0000BB\"]$total[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  5. like PMJ said, you'll probably just need to hand code a session variable at the time of login... simply place the session_start() function at the top of your code, and then once they have successfully logged in, just assign their username to a variable like this: $_SESSION['user'] = $username; then, you can access the $_SESSION['user'] variable on any page of that domain during the current session.
  6. interesting comment with how everything compliant is steering away from tables anyway! the only time i used frontpage for a project was when my boss required it, and then i spent more time going through and cleaning up code than i did actually designing the site... frontpage puts WAY too much extra nonsense coding in there for my taste! VI is awesome!!! lol
  7. narimanam has given you a very good suggestion to get started... i would recommend another specific, though... you can link several insert statements together and run them all with only one query to the database quite easily... let's say i want to insert 10 rows into my db, and i just want to insert values of 1001-1010 in a column named "number"... follow along and see if this will help you some: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php $number [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]1000[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$query [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]; for ([/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]< [/span][span style=\"color:#0000BB\"]10[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$i[/span][span style=\"color:#007700\"]++) { [/span][span style=\"color:#0000BB\"]$query [/span][span style=\"color:#007700\"].= [/span][span style=\"color:#DD0000\"]\"INSERT INTO table (number) VALUES (\'$number\'); \"[/span][span style=\"color:#007700\"]; } if ([/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$query[/span][span style=\"color:#007700\"])) { echo [/span][span style=\"color:#DD0000\"]\"Records successfully inserted.\"[/span][span style=\"color:#007700\"]; } else { echo [/span][span style=\"color:#DD0000\"]\"Error inserting data.\"[/span][span style=\"color:#007700\"]; } [/span][span style=\"color:#0000BB\"]?>[/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Hope this helps!
  8. just think of it this way: when you are using an array variable inside of quotes, you don't need to use the single quotes in the brackets "[]"... like this: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] echo \"<input name=\\"upmasthead\\" type=\\"radio\\" value=\\"0\\" title=\\"$radioTY\\" onclick=\\"MM_openBrWindow(\'pref_image_browser.php?img=pmasthead&id=$row_rs_newsletter[id]\',\'browser\',\'width=700,height=200\')\\"> Yes\n\"; [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  9. can you be a little more specific? i use dreamweaver mx 2004 at work, and i've never run into a problem... keep in mind that php is server side, so it will all be parsed before any of the html is even seen by the browser... with that in mind, it doesn't really matter technically where your php is placed, however, for readability, you may want to set some guidelines for yourself...
  10. [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#DD0000\"]\"Same here! I can\'t get the button to work in FF 0.9, but manual entry does!\"[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  11. for an extremely handy PHP reference manual, check out O'Reilly's "Programming PHP". it's not much help as a tutorial, but great as a reference
  12. in your query, you are only telling the database to give you every entry that has a matching id. that is going to return every entry every time. what you have to do to limit it is also provide the id of the content you want to get the number of results for. you need to do something like: SELECT content.id, messages.feedid FROM messages, content WHERE messages.feedid = content.id AND messages.feedid = '1'; you could also do something like this: SELECT COUNT(*) AS count, messages.feedid FROM message, content WHERE messages.feedid = content.id GROUP BY messages.feedid; this query will return you a table with two columns: count and id. then, you just need to loop through all your results to see how many entries you have in a given id. hope this helps!
  13. check out the nl2br() function. if you input the textarea value as nl2br($textareaValue), it will change all the newlines to <br /> for you!
  14. if you have the table for links with id, content (or link text), and url field, simply grab everything in the table, and loop through the results in your menu. then, use CSS to display everything like you want it. When a new link is added, it will just appear at the bottom of the menu: $sql = "SELECT * FROM MenuTable"; $results = mysql_query($sql) or die(); echo "<ul id='nav'>\n" while ($result = mysql_fetch_array($results)) { echo "<li><a href='".$result['url']."'>".$result['content']."</a></li>\n"; } echo "</ul>\n"; that will give you all the links pointed to the right place in a nice unordered list, and all you have to do is apply a nice style sheet to get it to look right!
  15. think of it this way (i hope i'm not simplifying too much, but based on your question, i'm assuming no prior knowledge): 1. what do i want to pull from my database? (SQL query) 2. where do i want to store the results until i display them? ($result variable) 3. how do i look through my results and display them? (while loop) let's pretend that you simply have a small table called 'Names' with the following info: ID | Name ----------------- 1 | George 2 | Ralph 3 | Sandra First, what do i want to pull -- in this case, i just want to list all the names: $sql = "SELECT Name FROM Names"; Next, i store the results so i can loop through them: $results = mysql_query($sql, $conn); Once i have the data, let's loop through and print each individual record: while ($result = mysql_fetch_array($results)) { $name = $result['Name']; echo $name . "<br />"; } this will list through all the names you have pulled from the database. hope this helps get you started!
×
×
  • 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.