627 Posted Topics
Re: Read the manual: [url]http://us.php.net/manual/en/mysqli.real-connect.php[/url] The second example clearly shows you: [iCODE]parent::init()[/iCODE] | |
Re: in php just use strtotime(): [CODE]echo date('Y-m-d', strtotime("now -30 days") );[/CODE] In your case INSTEAD of now you would use whatever date you have. | |
Re: try: [CODE] foreach($_SESSION['varukorg'] as $index=>$cart) { echo "<p>" . $cart['art'] . "</p>"; echo "<p>" . $cart['product'] . "</p>"; echo "<p>" . $cart['qte'] . "</p>"; echo "<p>" . $cart['price'] . "</p>"; echo "<p><a href=#><img src=\"/images/produkter/ $cart['image_cart'] \" width=100 height=100/></a></p>"; echo sprintf("<p><a href='%s?id=%s&action=d'>delete</a></p>",$_SERVER['PHP_SELF'],$index); } [/CODE] so when you click on the Delete … | |
Re: On line 115 you missed a closing ">" for your checkbox. [iCODE]<td><input type="checkbox" name="delFriends[]" value="<?php echo $rows['receiver_username'];?>" [COLOR="Red"][B]>[/B][/COLOR]</td></tr>[/iCODE] Also, line 23 is wrong. The name of your element is NOT "delFriends". Use the exact name you gave the element | |
Re: you would need a primary key in your table `mobilephones`. Do you have a primary key? If yes, what is it? Also, for effiency purposes, try to avoid [iCODE]SELECT *[/iCODE] if you are NOT going to use all the fields/columns in your table. Instead list only the fields/columns you need. | |
Re: javascript is case sensitive. To clarify, [iCODE]var greeting="...";[/iCODE] is different from: [iCODE]var Greeting="...";[/iCODE] In your case you declared and initialized a variable named allSelect (with uppercase "S"), but in the for you are using [iCODE]... < all[color="Red"][b]s[/b][/color]elect.length[/iCODE] (notice the lowercase "s"). The same problem exists in [iCODE]if (all[COLOR="Red"][B]s[/B][/COLOR]elect[i].className[/iCODE] | |
Re: You are currently executing 10 queries (one in every iteration). Instead, do NOT use a [iCODE]for[/iCODE] construct and instead execute ONE query. IF you want ALL the records, do NOT use a [iCODE]WHERE [/iCODE] clause - simply execute: [iCODE]Select cat_id, cat_name from tovanu.categories[/iCODE] If you want only the records with … | |
Re: On line 20 you are using a single "|" to mean "or". You need TWO since you are not doing bitwise OR-ing. Furthermore, that line should be: [iCODE]if(!isset($_POST['email']) || empty($_POST['email']) || !isset($_POST['pass']) || empty($_POST['pass']) )[/iCODE] Also, change [iCODE]mysql_fetch_array()[/iCODE] to [iCODE]mysql_fetch_assoc()[/iCODE] Lastly, IMMEDIATELY after the [iCODE]header("Location: account.php");[/iCODE] put [iCODE]exit();[/iCODE] | |
Re: try: [CODE] <td><textarea name="text" id="text" rows="26" cols="61" ><?php echo preg_replace('#<br\s*/?>#i', "\n", html_entity_decode($edit_servicedesc2));?></textarea> </td> [/CODE] | |
Re: try: [CODE] if( isset($_POST['btnSubmit']) ) { //......... foreach ( $_FILES['small_tn_']['name'] as $key=>$value1 ) { $smallImage=$_FILES['small_tn_']['name'][$key]; $largeImage=$_FILES['large_image_']['name'][$key]; $sql_small_tn = sprintf("INSERT INTO `overlay`(`small_tn`,`large_img`) VALUES ('%s','%s')",$smallImage, $largeImage ); $db->query($sql_small_tn); } } [/CODE] | |
Re: You are currently have the following (on line 164): [CODE]<input type='hidden' name='unit_price_". $row['pid'] ."' />[/CODE] The js function needs to compute: [iCODE]unit_price_X * qty_X[/iCODE] (where X is whatever value is in [iCODE]$row['pid'][/iCODE]) but you have NOT assigned a value! Since it is a hidden field, the user cannot enter anything … | |
Re: Instead of: [iCODE]$(this).closest('form').submit()[/iCODE] try: [iCODE]$('#login_form').submit()[/iCODE] AND make sure that there is NO html element with [iCODE]name="submit" [/iCODE](nor [iCODE]id="submit"[/iCODE]) | |
Re: you may want to use preg_replace_callback() for this. For the sake of clarity, let's say you have the following TWO (separate/independent) input strings a;b\";\"c;d';'ef\;g a;b\";'\"c;d';'ef\;g what results do you expect? Do you have a sample of an actual/realistic input string? | |
Re: You need to be more specific about what you are looking for. Assuming that the following dates are free (status==1): 2010-11-02 through 2010-11-10 2010-11-16 through 2010-11-20 and the person plans to stay for 4 days, are you looking for a two element array that states: 2-10 16-20 or ALL the … | |
Re: make sure that is no element with name="location" either. As an example, the following would not work as you expect in IE: [CODE]<script type="text/javascript"> window.onload=function(){ document.getElementById('location').innerHTML='hi' }; </script> <input name="location" /> <div id='location'></div> [/CODE] the getElementById() incorrectly returns a reference to the [B]INPUT[/B] instead of the [B]div[/B]. | |
Re: On your first block of code above, this is wrong: [iCODE]<tr id="data">...</tr>[/iCODE] If your query yields three records you will see the same id three times: [CODE] <tr id="data">... <tr id="data">... <tr id="data">...</tr> [/CODE] You are NOT allowed to have an id multiple times. It MUST be unique throughout the … | |
Re: In your constructor, [B]make, model and drive[/B] are all wrong. You MUST put apostrophes (or double quotes) around the values because those values are STRING values - ex: WRONG: [iCODE]this.drive = 4X4;[/iCODE] CORRECT: [iCODE]this.drive = '4X4';[/iCODE] So fix the above three statements first. As for lines 19-23, you CANNOT use … | |
Re: assuming you have: [CODE]<form id="theForm"...>[/CODE] on your SECOND block of code you posted, in line 6 - instead of: [iCODE]data: ...monstrosity of statements your currently have here...[/iCODE] simply use: [iCODE]data: $('#theForm').serialize()[/iCODE] The serialize() method should be able to determine accurately which of your radio buttons is actually checked. The problem … | |
Re: It looks like you are creating a RADIO AND a TEXT field with the SAME name every time. Give them different names. For example, try using this for line 15: [CODE] document.getElementById('segment_form').innerHTML += "<input type='text' name='[COLOR="Red"]txt_[/COLOR]segment_type_"+j+"' size='10' onFocus='check_other()' />"; [/CODE] | |
Re: the easiest approach would be NOT to use [iCODE]SELECT * ...[/iCODE]. Instead, mention explicitly which fields you want AND make sure the ones you want to hide appear first: [iCODE]SELECT ID, Code, Account Info, Ph#, User, PW, Web, Active[/iCODE] That way if you wanted to "hide" bod [B]ID[/B] and [B]Code[/B], … | |
Re: it should be [iCODE]while ([COLOR="Green"][B]$row[/B][/COLOR] = mysql_fetch_assoc($gar))[/iCODE] | |
Re: line 11 should be "[B]less than[/B] day.length" NOT "less than or equal to": [iCODE]for (i=0; i [COLOR="Green"][B]<[/B][/COLOR] day.length; i++)[/iCODE] | |
Re: what is NOT working on the code you posted? Are you NOT getting any results? Are you getting the ENTIRE table? Are you getting the WRONG id? Have you tried to echo your sql statement to verify what sql command is actually being executed? | |
Re: The problem is that when you provide an email, then the following IS executed: [CODE] else if ($_POST[email]) { $email = $_POST[email]; if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $err = 'Email invalid because wrong number of characters!<br />'; } } [/CODE] In other words, it goes INTO the email [b]else if[/b] clause and … | |
Re: If I understood correctly, what you need is: [CODE] <a href="images/image1.jpg"><img src="thumb_image1.jpg"></a> <a href="images/image2.jpg"><img src="thumb_image2.jpg"></a> [/CODE] | |
Re: at the end of the getBook method try adding [iCODE]return this;[/iCODE] | |
Re: In all three if statements you have the same error - on equal sign instead of two. EX: [iCODE]...&& ($site_type [COLOR="Red"][B]=[/B][/COLOR] "...")[/iCODE] it should be: [iCODE]...&& ($site_type [COLOR="Green"][B]==[/B][/COLOR] "...")[/iCODE] | |
Re: [CODE=html] <script type="text/javascript"> function setValue(field) { if(''!=field.defaultValue) { if(field.value==field.defaultValue) { field.value=''; } else if(''==field.value) { field.value=field.defaultValue; } } } </script> <input type="text" value="Enter Title" onfocus="setValue(this)" onblur="setValue(this)"/> [/CODE] | |
![]() | Re: try: [CODE] $sql="select * from users where twitter_id IN (" . implode(',',$friends) . ") AND status=1"; $result=mysql_query($sql) or die( mysql_error() ); $total=mysql_num_rows( $result ); [/CODE] ![]() |
Re: On the SECOND block of code you posted you are initializing [iCODE]$item_id[/iCODE] on line 6. You need to put the FIRST code of block AFTER line 6 of the second code of block. | |
Re: [QUOTE]You can change the CSS of image opacity and border style, but you cannot change the image's background color using CSS[/QUOTE] You can if you have the right type of image. What you need is to use images with TRASPARENT backgrounds. [CODE=html] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML … | |
Re: are you trying to execute the sql statement from WITHIN a function in main.php? If so, in your function you need to declare $new_id: [CODE] function(){ global $new_id; ... mysql_query('INSERT INTO comments (id) VALUES ($new_id)'); } [/CODE] | |
Re: Try: [CODE=php] $f=scandir('/Images/'); foreach($f as $p) { echo '<img src="/Images/'.$p.'" />'; }[/CODE] | |
Re: [QUOTE]But what if the user write it with inversion?[/QUOTE] You would need to write ANOTHER expression that would try to do a match based on the reverse order. Basically execute back-to-back replace() operations: [CODE] function tables(str){ var t={}; t["<table border='$2' width='$4'>"]=/\[table(:|\s+)border=(.+?)(\s+|;)width=(.+?)\]/ig; t["<table width='$2' border='$4'>"]=/\[table(:|\s+)width=(.+?)(\s+|;)border=(.+?)\]/ig; t["<table border='$2'>"]=/\[table(:|\s+)border=(.+?)\]/ig; t["<table width='$2'>"]=/\[table(:|\s+)width=(.+?)\]/ig; t["<table>"]=/\[table\]/ig; for( … | |
![]() | Re: lines 15 and 16 should be: [CODE] $user = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string($_POST['password']); [/CODE] As for your ACTUAL problem, the reason for the error is that you are putting APOSTROPHES around the table and field names. That is wrong. You need backticks (On a standard English keyboard, it is on … |
Re: try parenthesizing your selects: [CODE] ... else { $query .= "(select * from `table1` WHERE `year`='$cat') union (select * from `table2` where `year`='$cat') order by `year` desc "; } ... [/CODE] As for the second part of your question, you could put a dropdown with the list of available categories … | |
Re: Do NOT give an element a name and/or id that is the same as a javascript function. This would result in a name collision. Rename your function to Calculate (upper case "C") and update the onclick attribute on line 111. Also, in checkplan() it looks like this: [iCODE]var but = … | |
Re: Based on what you posted, it looks like what you are actually doing is: a. send some HTML markup by including admin_homepage.php'(probably the <html><head>...</head><body>...) b. query the db c. download excel file The problem is that if you are going to force a download, you cannot send any HTML markup … | |
Re: REMOVE those "invalid" definitions from your initial CSS file. Instead, add them dynamically through javascript (by importing a "supplemental.css" file - [url]http://www.hunlock.com/blogs/Howto_Dynamically_Insert_Javascript_And_CSS[/url]). The validator will not execute javascript so it should validate only the "good" css. ![]() | |
Re: try changing: [iCODE] if($("#Rep_Email_Address1").length > 0){[/iCODE] to: [iCODE] if($("#Rep_Email_Address1")[COLOR="Green"][B].val()[/B][/COLOR].length > 0){[/iCODE] if the problem persist, go the addOns page for Firefox and look for Firebug. Install it, restart Firefox and go back to your page. Then specify on which line the error is happening. | |
Re: try: [CODE] function links(str){ return str.replace(/\[link\s*=\s*(['"])?(.*?)\1\s*\](.+?)\[\/link\]/ig,'<a href="$2">$3</a>').replace(/\[link\](.+?)\[\/link\]/ig,'<a href="$1">$1</a>'); } [/CODE] | |
Re: Try the following: [CODE] <?php if(isset($_POST['email'])) { // recipient and subject $email_to = "gathering@sixcrows.org"; $email_subject = "OJAJA Talent Shindig Registration"; function died($error) { // error code here echo "Sorry, some of the required information is missing. "; echo "Note the red asterists for required fields.<br /><br />"; echo $error."<br /><br … | |
Re: [QUOTE]preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match... [url]http://php.net/manual/en/function.preg-match.php[/url] [/QUOTE] try simply [iCODE]if($fname_match)[/iCODE] Or if you want to be more "clear": [iCODE]if($fname_match > 0)[/iCODE] | |
Re: On line 12 you have [iCODE]$q = $db->exec($checkUsername);[/iCODE]. That tells me that you have a custom class (you are possibly executing something like [iCODE]$db=new MDB2(....);[/iCODE] somewhere) that has its own execute method (named exec). Within that method try putting/attaching [iCODE] or die( pg_last_error($conn) )[/iCODE] (refer to [url]http://www.php.net/manual/en/function.pg-last-error.php[/url]) to your actual … | |
Re: IF you run the code you posted and look at the browser's source code (CTRL+U in Firefox an Chrome; View -> Source in IE) you should be seeing: [CODE] <FORM action='delrec.php?id='. mysql_insert_id() .'' method='post' <table...> [/CODE] There are a few issues with this: a. The [iCODE][B]FORM[/B][/iCODE] tag is NOT closed! … | |
Re: the problem is due to a missing apostrophe after [iCODE]$name[/iCODE]: [iCODE](NULL, '$name[COLOR="Red"][B]'[/B][/COLOR], '$username', '2010-10-23', '$password')[/iCODE] But I suggest you try the following: [CODE]<html> <head> <title>Using Default Checkbox Values</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript" > $(function() { $(".submit").click(function() { var name = encodeURIComponent($.trim($("#name").val())); var username = encodeURIComponent($.trim($("#username").val())); var password = encodeURIComponent($.trim($("#password").val())); … | |
Re: [iCODE]$users[$uid]['userName'] = [COLOR="Red"]'[/COLOR]$username[COLOR="Red"]'[/COLOR];[/iCODE] should be: [iCODE]$users[$uid]['userName'] = $username;[/iCODE] No apostrophes around [iCODE]$username[/iCODE]. Other than that, make sure that the AJAX_CHAT_XXX CONSTANTS you are using are defined. | |
Re: On your INITIAL post, try: [CODE]$sql = "SELECT CDID, COUNT(*) AS total FROM rtnUser GROUP BY CDID"; [/CODE] | |
Re: do your includes do includes as well? Read the following comment: [url]http://www.php.net/manual/en/function.dirname.php#91208[/url] | |
Re: are you saying that you want to "read" the "X" from the url and make it into a JS variable? |
The End.