Jump to content

shaunmckinnon

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by shaunmckinnon

  1. Fixed with this: public function deleteIt($id) { $conn = $this -> connect_open(); // set the table $table = $this -> table; // delete the row required $sql = "DELETE FROM $table WHERE id = $id"; if($conn -> query($sql)) { try { return (int)(($conn->affected_rows > 0) ? true : false); } catch (Exception $e) { echo '<br>Caught exception: ', $e -> getMessage(), '<br>'; } } else { return (int)false; } $conn = $this -> connect_close(); } Thanks again for the help.
  2. Thanks!!! That is exactly what I want. My brain is fried. I've been doing this for 12 hours straight. Time to unplug.
  3. Never mind. I var_dump'd the value in my file that's getting the returned value and it comes up bool(false). $dbman = new DBManipulate; $dbman -> set_Table('users'); $result = $dbman -> deleteIt(6); var_dump($result); I need to learn more. Cheers and thanks for the help!
  4. Thank you. I never knew that, but it makes perfect sense. I'm not doing anything yet. I just want a returned value of either true or false. It's so bizarre. I could just return 1 or 0 and It works. But the second I change it to true or false, even with (int)false, it refuses to obey. Here is the adjusted code: public function deleteIt($id) { $conn = $this -> connect_open(); // set the table $table = $this -> table; // delete the row required $sql = "DELETE FROM $table WHERE id = $id"; if($conn -> query($sql)) { try { return (int)$conn -> affected_rows > 0; } catch (Exception $e) { echo '<br>Caught exception: ', $e -> getMessage(), '<br>'; } } else { return (int)false; } $conn = $this -> connect_close(); }
  5. I don't know if this makes a difference, but here is the whole method: public function deleteIt($id) { $conn = $this -> connect_open(); // set the table $table = $this -> table; // delete the row required $sql = "DELETE FROM $table WHERE id = $id"; if($conn -> query($sql)) { try { return $conn -> affected_rows > 0; } catch (Exception $e) { echo '<br>Caught exception: ', $e -> getMessage(), '<br>'; } } else { return false; } $conn = $this -> connect_close(); }
  6. False should return as "0", as True returns as "1". Either way, it doesn't return. Thanks for the help on getting rid of the ternary. I've tried a crazy amount of things and now I'm stuck in a circle of bad practice. lol However, even with your change, it still won't return the boolean. I still get nothing. Here is the current code: $sql = "DELETE FROM $table WHERE id = $id"; if($conn -> query($sql)) { try { return $conn -> affected_rows > 0; } catch (Exception $e) { echo '<br>Caught exception: ', $e -> getMessage(), '<br>'; } } else { return false; }
  7. Hello: I've just started learning OOPHP, and I love it!!! However, I've come across a strange issue. I'm trying to return a boolean value from my ternary statement. It will not return the boolean. I can return a string literal, an integer, anything else you can think of, but not a boolean. I'm curious if someone could explain why. Here's the code: // delete the row required $sql = "DELETE FROM $table WHERE id = $id"; if($conn -> query($sql)) { try { $num = ($conn -> affected_rows > 0) ? true : false; return $num; } catch (Exception $e) { echo '<br>Caught exception: ', $e -> getMessage(), '<br>'; } } else { return false; } Any help is appreciated. Thank you so much in advance.
  8. that should work. if you're trying to pass PHP variables, you need to echo the variables in the javascript code. probably easier to <? $variable_1 = "unchecked"; $variable_2 = "checked"; echo '<input type="radio" id="" name="" value="'.$variable_1.'">'; ?> i would just block what i need to do in a small php block. still don't quite know what you're looking to do, but hopefully one of these code blocks can help decipher some hassle for you.
  9. I think you're trying to pass PHP variables to the javascript function. If that's the case, you may be approaching it wrong. ie: <html> <head> <script> function check(n1,n2) { document.getElementById('n1').checked=true; document.getElementById('n2').checked=true; } <script> </head> <body> <form> <input type="radio" id="n1" name="n1"> <input type="radio" id="n2" name="n2"> <input type="button" id="checker" name="checker" onClick="check('n1', n2');"> </form> </body> </html> [code] [/code]
  10. sorry, i fixed that. it's still doing the same thing now in both firefox and internet explorer. it shows the select box but when you attempt to make a selection it closes the box on you and doesn't allow it. in fact when you click the arrow, the drop down box recede's immediately.
  11. explain further. do you mean you're trying to call the onClick event in PHP?
  12. when I parse it shows in firefox the select box, but won't let it be selectable. in explorer it just shows AMPM side by side with now select box. Can't figure out what I've done wrong. Here's the code: <html> <head> <title>test</title> <script> function createTimeSelect(id){ document.getElementById(id).innerHTML="" +"<input type='text' id='' name='' value='hour' size='6'>" +":" +"<input type='text' id='' name='' value='minutes' size='6'" +"<select id='' name=''>" +"<option value=''>AM</option>" +"<option value=''>PM</option>" +"</select>"; } </script> </head> <body> <span id="timeSelectField" onClick="createTimeSelect(this.id);">***click here to select the time***</span> </body> </html> Thanks, Shaun
  13. not sure what the problem is. everytime I run this script it tells me that the getElementById is undefined: <html> <head> <title>test</title> <script> // JavaScript Document //testing var var displayTest; //***256fX Calendar Widget*** //labels for the days of the week, names of the months, and number of days in each month days = new Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); noDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); //fall back to today's date today = new Date(); var x = months.length; for(i=0; i<x; i++){ document.getElementById("testing").innerHTML="<br>"+months[i]+" - "+noDays[i]+"<br>"; } </script> </head> <body> <p id="testing"></p> </body> </html> any help would be appreciated. I'm quite new to Javascript, so it's probably something dumb. thanks, shaun
  14. just figured that out LOL wow!!! really important to keep up with this stuff if you want to remember it. thanks.
  15. i don't get this. i use to know this simple stuff, and after a year it seems i forgot all of it. anyways, i can't get any reaction from this form. here's the form page: <? //very simple invoicing system ?> <?php require_once('Connections/connect_me.php'); ?> <?php mysql_select_db($database_connect_me, $connect_me); $query_client = "SELECT * FROM client_data"; $client = mysql_query($query_client, $connect_me) or die(mysql_error()); $row_client = mysql_fetch_assoc($client); $totalRows_client = mysql_num_rows($client); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Simple Invoice</title> <link href="invoiceCSS.css" rel="stylesheet" type="text/css"> </head> <body> <form name="invoice" method="post" action="test.php"> <select name="selecting"> <?php do { ?> <option value="<?php echo $row_client['ID']?>"><?php echo $row_client['CLIENT_NAME']?></option> <?php } while ($row_client = mysql_fetch_assoc($client)); $rows = mysql_num_rows($client); if($rows > 0) { mysql_data_seek($client, 0); $row_client = mysql_fetch_assoc($client); } ?> </select> <table id="invTbl" border="1px" bordercolor="#000000" cellspacing="0" cellpadding="0"> <tr> <td align="center" class="headers">Date</td> <td align="center" class="headers">Description</td> <td align="center" class="headers">Quantity</td> <td align="center" class="headers">Price</td> <td align="center" class="headers">Subtotal</td> </tr> <tr> <td bgcolor="#CCCC99"><input name="fields" type="text" id="date" class="allOthers" value="<? echo date('Y-m-d'); ?>" size="11"></td> <td bgcolor="#CCCC99"><input name="fields" type="text" id="description" class="allOthers" size="50"></td> <td bgcolor="#8EAE93"><input name="fields" type="text" id="quantity" class="qtyprcTotalCol"size="5"></td> <td bgcolor="#8EAE93">$<input name="fields" type="text" id="price" class="qtyprcTotalCol" size="6"></td> <td bgcolor="#C1E0FF">$<input name="fields" type="text" id="sub_total" class="subTotalCol" size="6"></td> </tr> </table> <input type="text" id="counterHidden"> <input type="submit" id="submit" class="submit" size="6"> <input type="reset" id="reset" class="submit" size="6"> <input type="text" id="total" class="submit" size="6"> </form> </body> </html> <?php mysql_free_result($client); ?> and here's the test.php page it's being sent to: <?php $date=$_POST['date']; $description=$_POST['description']; $quantity=$_POST['quantity']; $price=$_POST['price']; $sub_total=$_POST['sub_total']; echo '<br>'.$date; echo '<br>'.$description; echo '<br>'.$quantity; echo '<br>'.$price; echo '<br>'.$sub_total; ?> it outputs the breaks, but not the info i paste in. i'd link to the page, but it's on an internal server that's not out to the web. any help would be appreciated. thanks, shaun
  16. [!--quoteo(post=368736:date=Apr 26 2006, 04:49 AM:name=JRS)--][div class=\'quotetop\']QUOTE(JRS @ Apr 26 2006, 04:49 AM) [snapback]368736[/snapback][/div][div class=\'quotemain\'][!--quotec--] Shaun, Don't know what the problem is, but my advice is to download PHPMailer from sourceforge.net and use it. I spent countless hours trying to figure out these stupid mail headers - it's not worth the trouble. There is a tutorial on this site that takes you step by step through PHPMailer - took me 30 minutes to download, setup and start mailing (attachments, HTML, plain text). Good luck JRS [/quote] thanks, that's what i'll do i guess. it seems to me only last year that all you had to do was go mail($to, $subject, $body); and you were done. oh well. thank again.
  17. prolly stoopid me: here's what's happening: wrote a simple mail script just to check the sending capabilities. mail refused to send. tried over and over again, still wouldn't send. sent to hotmail box instead of my outlook account. found it in the junk mail folder. thought "all right, maybe it's harder now." went to a forum to see if anyone else has had this issue. found this script. [code]<? $mailtext = 'whatever'; $mailto = 'myemail@here.com'; $mailsubject = 'Us - Contact us enquiry'; $mailheaders .= "From: Shaun McKinnon Enquiry <myemail@here.com>\r\n"; $mailheaders .= 'MIME-Version: 1.0' . "\r\n"; $mailheaders .= 'Content-Type: multipart/mixed' . "\r\n"; $mailheaders .= " boundary=\"$mime_boundary\""; $mailheaders .= "Reply-To: myemail@here.com\r\n"; $mailheaders .= "Return-Path: myemail@here.com\n"; if ($errormessage == ''){ mail($mailto,$mailsubject,$mailtext,$mailheaders); exit; } ?>[/code] checked it, still goes to the junk mail folder and doesn't even appear in outlook. I receive crap in my outlook daily, so it's not restrictions on the server we use for the website. Is there anything anyone might know that would cause this issue?
  18. or if perchance you're hosting locally, make sure that your testing server is in the location of your server, ie: apache: (htdocs folder), or that you've told your server where your new www directory is.
  19. had the exact same problem, and here's what corrected it: if you're hosting your site remotely, (like myself), and you upload your site, for some reason that stupid file doesn't upload to the www directory like it's suppose to. Here's the solution. Get SmartFTP and force an upload of that file into your www directory. Then Dreamweaver will have no problem finding it, and it will work good.
  20. OK, here's my problem, my tables are displaying vertically, and not horizontally. I need them to go horizontal when they fill up with the mysql records. how do i get the repeat region function in dreamweaver to display these horizontally???
  21. How do I get an insert form to update the date everytime someone submits a new entry. I realize this is probably incredbly simple...here's my php: function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO Lyrics (ID, `DATE`, BAND, QUOTE, SUBMITTED_BY, EMAIL) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['ID'], "int"), GetSQLValueString($_POST['DATE'], "date"), GetSQLValueString($_POST['BAND'], "text"), GetSQLValueString($_POST['QUOTE'], "text"), GetSQLValueString($_POST['SUBMITTED_BY'], "text"), GetSQLValueString($_POST['EMAIL'], "text")); mysql_select_db($database_lyricalquotes, $lyricalquotes); $Result1 = mysql_query($insertSQL, $lyricalquotes) or die(mysql_error()); $insertGoTo = "lyrics.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_lyricalquotes, $lyricalquotes); $query_submitlyrics = "SELECT * FROM Lyrics ORDER BY ID DESC"; $submitlyrics = mysql_query($query_submitlyrics, $lyricalquotes) or die(mysql_error()); $row_submitlyrics = mysql_fetch_assoc($submitlyrics); $totalRows_submitlyrics = mysql_num_rows($submitlyrics); and then my form: <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Band:</td> <td><input type="text" name="BAND" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Quote:</td> <td> <textarea name="QUOTE" cols="50" rows="5"></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Submitted By:</td> <td><input type="text" name="SUBMITTED_BY" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="EMAIL" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> <input type="hidden" name="ID" value=""> <input name="DATE" type="hidden" value=""> <input type="hidden" name="MM_insert" value="form1"> </form> Any help would be greatly appreciated!!! Thanks in advance, Shaun McKinnon (to check out what it's doing currently, go to Lyrical Quotes )
  22. Dreamweaver 2004 automatically comes with this new extension, but if you just bought a retail copy of mx, then you should do a search for extensions. a tip when searching: type DW instead of dreamweaver..tend to get more hits. Shaun McKinnon 256 FX designs.
  23. Dreamweaver MX 2004 has the delete records function...just decided to let everyone know...I've been reading web monkey tutorials, and I've learned a bit about php...i'm not a coder, but at least i understand a bit more about the code Shaun McKinnon 256FX Designs
  24. Hey Everyone: Thanks a lot for your suggestions. I think I'm going to try all your suggestions. I'm getting around to registering my company, (our boss wants contractors, not employees, the cheap bastard), so I'd like to be able to provide more then just pretty pictures. If I figure out any really good scripts, I'll post them here. Thanks again, Shaun McKinnon 256FX Designs.ca
×
×
  • 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.