Jump to content

jake2891

Members
  • Posts

    113
  • Joined

  • Last visited

    Never

Everything posted by jake2891

  1. hey guys id just like some input when you should use oop programming and when you should use procedural programming?
  2. lol this post was posted in october haha dont think he'd be seeing our replies now.
  3. yeah i just tested that code on a mysql db and it works for me. can you put a or die(mysql_error()) on your query and see what it says. show us your insert statement. heres my example one i used just for testing not to make code secure and nice etc... <?php $conn = mysql_connect("***","***","***"); mysql_selectdb("testsql"); $timestampInSeconds = $_SERVER['REQUEST_TIME']; $mySqlDateTime= date("Y-m-d H:i:s", $timestampInSeconds); mysql_query("insert into hello (`test1`)values('$mySqlDateTime')"); $q = mysql_query("select * from hello"); while($row = mysql_fetch_array($q,MYSQL_ASSOC)){ echo $row['test1']."<br>"; } ?>
  4. have you created the ch2 directory in your htdocs directory? seems like a silly question i know but u never know . does anything get displayed on the webpage in your browser when you open the page anything at all?
  5. is it just one file or all? can you post your php file your trying to run from /ch2/foo.php. also are you using something like wamp etc?
  6. you can use it for a dev or live environment. or if your writing a reusable piece of code where the host may change.
  7. the codes using jquery have you downloaded and installed that seeing as you just copied the code from somewhere?
  8. WHERE email=='$email' AND username=='$username' should be WHERE email='$email' AND username='$username'
  9. just do this on the next form <?php if($_POST['text']){ echo 'got text'; }else{ echo 'no text'; } if($_POST['graphic']){ echo 'got graphic'; // can do something now }else{ echo 'no graphic'; // cant do shit } ?>
  10. change the javascript function check i gave you to this instead its overkill but it will work. function check(){ var none_checked = false; var graphics = document.getElementsByName("graphic[]"); var text = document.getElementsByName("text[]"); for(i=0;i<graphics.length;i++){ if(!graphics[i].checked){ none_checked = true; } } for(i=0;i<text.length;i++){ if(!text[i].checked){ none_checked = true; } } if(none_checked == true){ document.getElementById('submit').style.display='none'; }else{ document.getElementById('submit').style.display='block'; } for(i=0;i<graphics.length;i++){ if(graphics[i].checked){ if(document.getElementById('submit').style.display=='none'){ document.getElementById('submit').style.display='block'; } } } for(i=0;i<text.length;i++){ if(text[i].checked){ if(document.getElementById('submit').style.display=='none'){ document.getElementById('submit').style.display='block'; } } } }
  11. yeah if you write a php script that connects to the database loops through records and finds a match for a birthday on that day it would mail them. just create a cron job to run your php script once a day in the morning or something.
  12. no thats not rite because if the id is unique your fetching one record instead of an array of records? if your only wanting one record then use mysql_fetch_row instead. $query = mysql_query("SELECT * FROM content WHERE id =1") or die(mysql_error()); if($query){ $row = mysql_fetch_row($query); } // if your table is structure like this? $row[0]; // id $row[1]; // title $row[2]; // content
  13. hmm well if you make it that when there is no checked boxes the submit dissappears again like i mentioned earlier you wont get an empty array on the next page unless you get a sneaky hacker then you would have to validate alot more.
  14. yeah you can do this $query = mysql_query('SELECT * FROM contact'); while($results = mysql_fetch_array($query,MYSQL_ASSOC)){ $title = $results['title']; $id = $results['id']; $content = $results['content']; echo "<a href=\"javascript:void(0);\" onclick=\"show_content($id)\">$title</a>"; echo "<div id=\"$id\" style=\"display:none\">$content</div>"; }
  15. lol... yeah man ull need to pull the content from ur table into the results variable and add in any other spacing and css you want to distance the links and divs etc.. let me know if u dont understand
  16. is this what u mean?? <html> <head> <script> function show_content(id){ document.getElementById(id).style.display='block'; } </script> </head> </html> <?php // sudo code foreach($results as $result){ // results holding your records from your content table $title = $result['title']; $id = $result['id']; $content = $result['content']; echo "<a href=\"javascript:void(0);\" onclick=\"show_content($id)\">$title</a>"; echo "<div id=\"$id\" style=\"display:none\">$content</div>"; } ?>
  17. im not sure why your getting the undefined index as i dont have that problem when i run the code. if you want to check on the php side you can use the empty function or javascript use the length function. post ur full code for me to see with regards to that index problem
  18. $row[1] = the table user field not fred
  19. true but if he wants all the results and only use freds results for something then he can do it that way
  20. <html> <head> <script type="text/javascript"> function check(){ var graphics = document.getElementsByName("graphic[]"); for(i=0;i<graphics.length;i++){ if(graphics[i].checked){ if(document.getElementById('submit').style.display=='none'){ document.getElementById('submit').style.display='block'; } } } var text = document.getElementsByName("text[]"); for(i=0;i<text.length;i++){ if(text[i].checked){ if(document.getElementById('submit').style.display=='none'){ document.getElementById('submit').style.display='block'; } } } } </script> </head> <form action="<?php echo url_for('doc/document'); ?>" method="post"> <input type='hidden' name='service_id' value='<?php echo $service->getId() ?>'> <table width='1000px' border='0' cellspacing='0'> <tr> <td class='td_header_2' align='left' colspan='2' width='50%'> Available products for service: <?php echo $service->getName()?> </td> </tr> <tr> <table width='600px' class='tbl_content_box' border='0' cellspacing='0'> <tr> <td width='100px'>Products:</td> <td width='100px'>Graphic</td> <td width='100px'>Text</td> </tr> </table> <table> <table width='600px' class='tbl_content_box' border='0' cellspacing='0'><?php $product_names = LpmPagePeer::getByAllProdNames($service->getId()); foreach($product_names as $product_row) { ?> <tr> <td > </td><td width='200px'>bla</td> <td width='200px'><input type="checkbox" name="graphic[]" value="<?php echo $product_row->getId();?>" onclick="check()"/></td> <td width='200px'><input type="checkbox" name="text[]" value="<?php echo $product_row->getId();?>" onclick="check()"/></td> </tr> <?php } ?> </table> <table> <tr> <td> <input id="submit" type='submit' name='submit' value='Submit' style="display:none"> <?php if($_POST['graphic']){ $graphics_selected = $_POST['graphic']; foreach($graphics_selected as $val) { echo $val."\n"; } } ?> </td> </tr> </table> </form>
  21. what exactly are you trying to accomplish with this query? group by is used in conjuction with aggregate functions
  22. your supposed to add the lines i removed back in place of the test arrays i made to test it myself
  23. select * from tablename order by name,number asc
  24. <html> <body> <?php include 'dbwire.php'; $query = mysql_query('SELECT * FROM user'); while ($row = mysql_fetch_array($query)) { if($row[1] == 'Fred'){ echo '<b>User:</b> ' . $row[1] . '<br />'; } } ?> </body> </html>
×
×
  • 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.