PHP - Where To Get A Database For Zip-codes That Has The Grid_n And Grid_e References
I have been searching for a few weeks now and decided to get a little help on this on.
I am after a database like that which I found for the UK postcode, but one for the USA but it needs to have the North and East references. Has anyone come across a site that offers a basic zipcode, state, Grid_N and Grid_E references ? if so please can you let me know what sites you have used. Similar TutorialsHi, I will really need some help here. I have posted this similar topic quite a number of times, however no one could actually give me a solution. Currently when I execute the code, it seems like "mysqli_num_rows($data3) !== 1", therefore my {else} command was executed instead. "else {echo '<p class="error">There was a problem accessing your profile.</p>';}" I have no idea what went wrong, and if you look at my attachment.jpg, there are 3 columns 1) overall_level_subject_id 2) tutor_id 3) subject_level_id The thing is that, there are similar tutor_id appearing in this table and it may not be in sequence, take for example... overall_level_subject_id: 10 tutor_id: T532uu subject_level_id: 11 overall_level_subject_id: 51 tutor_id: T532uu subject_level_id: 12 I'm not too sure if you guys understand what I am explaining. But I really need help in this area! Please advice! Code: [Select] <?php /*************************Teaching Subjects*************************/ $query3 = "SELECT subject_level_id FROM tutor_overall_level_subject WHERE tutor_id = '" . $_GET['tutor_id'] . "'"; $data3 = mysqli_query($dbc, $query3) or die(mysqli_error($dbc)); if (mysqli_num_rows($data3) == 1) { echo '<div id="panel4">'; echo'<table><tr>'; $count = 0; // Start your counter while($row3 = mysqli_fetch_array($data3)) { if ($count % 5 == 0) { echo "</tr><tr>"; $count = 0; } echo '<td class="label">' . $row3['subject_level_id'] . '</td><td>' . $row3['subject_level_id'] . '</td>'; $count++; } echo '</tr></table><br/>'; echo '</div>'; //End of panel 4 } //End of IF for $query and $data (Teaching Subjects) else { echo '<p class="error">There was a problem accessing your profile.</p>'; } ?> Actually i have a very large object thats persistent using sessions. That object have two large arrays, and other things. I have to extract each time that arrays. Now im using: $configuracion = $_SESSION['reg']->GetInvConfig(); $categorias = $_SESSION['reg']->GetInvCategorias(); But if i get it well, this is copying all the array each time, no? i can use a reference to that array in the object easily to improve performace? I can not seem to get this to work so wondered if I can do this or not. Code: [Select] $_SESSION['ref123'] = "my item"; for some reason it is not storing when i try this, how do I allow letters ? Hi there just wanted to ask you a general question regarding referenced variables and functions in PHP. I have this code: function theRefFunction(&$var){ $var = $var +1; return $var; } $a = 50; echo $thisvalue = theRefFunction($a); Just for learning purposes, as allot of times beginning PHP seriously developers who want to improve on memory consumption in PHP find this tricky, is there any point in using an example like this? I.e. would I really need the &$var as the parameter for the function called 'theRefFunction()'? Just wondered thats all, if not what would be a better way for really using it? It's just so I can go onto maybe doing a loop in it and setting it as a real example like working out tax and stuff like that, just for learning purposes, won't yet be using it. Just wanted to build up as I said earlier a library of things I have done and make maybe my own tutorial site. I look forward to any replies, Jeremy. Well my forum code is almost complete and one feature it is lacking is BB Codes. How would I go about making BB Codes for the following: Code: [Select] [URL=Url]Title[/URL] [IMG]Img Url[/IMG] [b]bold[/b] [i]Italics[/i] [u]Underline[/u] [s]Strike-through[/s] These are the only ones I want atm so any help would be appreciated. hello freinds, iam new to this forum and new to php. i have just finished a course on html and css. but now i have realised that its become comulsory for me to learn php. but iam confused as to what ellements of php i should learn. since this is a programming language i find its gonna be real tuff for me, can u please advise as to which parts i should learn first to get going. i wont be developing custom websites for customers, just for my own hobbies. my main ambition is to utilise API's in my websites. Thanx Hello, I have been trying to come up with bar codes in php to represent integers for example 7432973853. How do I get a bar code for a particular string of numbers? Hey eveyone, I have this great idea I would love to do but I have some questions and whenever I have questions I come here and they always get answered :-) Anyway what do you guys know about SMS short codes (you know those commercials on TV that are like text ringtone1 to 555)? I did some quick reading and it seems they are super expensive?!? Is there anyway to get them free or cheaper if you can write your own code? Has anyone had any experience with sms short codes? Also is there anyway for a site to receive a SMS and then charge that persons service provider with php? Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317279.0 I am not sure what is going wrong but I have not changed any of my codes and now I am getting this error message on a simple form that I am testing. Any idea what has happened. I have had several successful tries that have updated to the db. Quote Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 20 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 20 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/form.php on line 21 Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 29 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 29 This is the form Code: [Select] <?php @include_once ("Connections/connect_to_mysql.php") or die('could not connect to database'); $err=''; if($_POST["submit"]){ // Validate form data if($_POST["firstname"]=='') $err.='Please enter First Name<br>'; if($_POST["email"]=='') $err.='Please enter Email<br>'; if($err==''){ // Check if there are duplicate entries in the 'contacts' table $results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'"); if($row = mysql_fetch_array($results)){ $err.='Can not add duplicate entry<br>'; } else{ // adding new record to 'contacts' table mysql_query("INSERT INTO Members (firstname,lastname,country,Email) values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')"); // redirecting to success screen exit; } } } ?>The HTML below.. Code: [Select] <html> <head> <title>Add New Contact</title> </head> <body> <h2>Register with us</h2> <?php echo $err==''?'':('<p style="color:red;">'.$err.'</p>') ?> <form method="post" action="form.php"> <table border="0"> <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> <tr> <td valign="middle">Last Name:</td> <td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td> </tr> <tr> <td valign="middle">Country:</td> <td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td> </tr> <tr> <td valign="middle">Email:</td> <td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td> </tr> </table><br> <input type="submit" name="submit" value=" Submit! "> </form> </body> </html> Hellow every one; i need little help to change code in my script version as i have older version codes and em using new version script so i need to change codes on my version script. iam using latest script which codes are these Quote if ($CURUSER['control_panel'] == 'yes' && $privacylevel == 'strong') print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: ---<br />Downloaded: ---<br />Ratio: ---<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and Quote else print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: '.$useruploaded.'<br />Downloaded: '.$userdownloaded.'<br />Ratio: '.$userratio.'<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and i want to change them under Quote if ($row["class"] == 3 || $row["donated"] > 0) { if ($site_config["donatedstar"] || $site_config["vipstar"]) { $star = "<img src=images/star.gif border=0>"; } else { $star = ""; } } if ($privacylevel != "strong" || ($CURUSER["control_panel"] == "yes")) { print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: $useruploaded<br>Downloaded: $userdownloaded<br>Ratio: $userratio<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); and Quote }else{ print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: ---<br>Downloaded: ---<br>Ratio: ---<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); } and one more thing i have two different images for both classes as in older codes version only one image specify for both class but em using two images for "Donated" = start.gif and for "VIP" = vip.gif so i want both images for both class so pls help me how to do them. Thanks, Regards. Hi, below is the output from FMS streams in XML format. and there is no way i can change the format of XML file, how do it just get just codes( like 20p5tc0bqm25an2, 42fem6h84kq3nmb, etc) Thank you <?xml version="1.0" encoding="utf-8" ?> - <result> <level>status</level> <code>NetConnection.Call.Success</code> <timestamp>8/25/2010 2:51:34 AM</timestamp> <name>_defaultRoot_:_defaultVHost_:::_1</name> - <data> <_0>20p5tc0bqm25an2</_0> <_1>42fem6h84kq3nmb</_1> <_2>b2zudqmrfqa05a6</_2> <_3>bsbzrnde1z4qmdv</_3> <_4>cgpm8wlvzyrp6b7</_4> <_5>hqy95ympgq1t5ui</_5> <_6>qa8ultkr5pv2vas</_6> <_7>qr94iqvdqag26ee</_7> <_8>wjesw80adgv4usu</_8> <_9>zcdua1yok7kw5l4</_9> </data> </result> Hello everyone, Can somebody help me? I am a novice in PHP programming. I do not understand a line of code below: $action = isset($_GET['action']) ? $_GET['action'] : ''; The variables $action saves the values obtained by the GET method, but what does this piece of code ? $_GET['action'] : ''; Thanks in advance! hello, please can anyone help me out with the codes I want to pivot it Item ID Year Type Item Value 68 2012 Assets Cash 343.556 69 2012 Assets Treasury bills 343.556 70 2012 Assets Cash and Short Term funds 687.111 71 2012 Assets Collateral by Third Parties 343.556 72 2012 Assets Operating account with Central Banks 343.556 73 2012 Assets Cash reserves with Central Banks 343.556 74 2012 Assets Overnight placements 343.556 75 2012 Assets Eskrow with Central Banks 343.556 76 2012 Assets Banks within Nigeria 343.556 77 2012 Assets Banks outside Nigeria 343.556 78 2012 Assets Inter-bank placements 343.556 79 2012 Assets Provision for doubtful balances 343.556 80 2012 Assets Federal Government of Nigeria bonds 343.556 81 2012 Assets Due from banks 2748.44 82 2012 Assets Listed equity securities 343.556 83 2012 Assets Other liquid assets 343.556 84 2012 Assets Dealing securities 687.111 85 2012 Assets Overdrafts 343.556 86 2012 Assets Term loans 0 87 2012 Assets Mortgage loans 0 88 2012 Assets Commercial paper 0 89 2012 Assets Originated by the bank 343.556 90 2012 Assets Other 0 91 2012 Assets Loan loss provision 0 92 2012 Assets Loans and advances 0 93 2012 Assets Interest in suspence 0 94 2012 Assets Advances under finance lease 0 95 2012 Assets Other assets 0 96 2012 Assets Investment securities 0 97 2012 Assets Investment in subsidiary 0 98 2012 Assets Insurance assets 0 99 2012 Assets Other facilities 0 100 2012 Assets Goodwill 0 101 2012 Assets Defferes tax assets 0 102 2012 Assets Property and equipment 0 103 2012 Assets total Assets 4809.78 to Item 2012 2011 2010 2009 2008 2007 2006 ... Cash 0 0 0 0 0 0 0 Treasury bills 0 0 0 0 0 0 0 . . . I need to do pivot it and display using PHP as all possible ways to do the using Mysql was unsuccessful I am letting users select there color code option for text-shadow for there username I am storing them into a field called "color" HEX exaMPLE: FF6633,AA3633 First is the background color, 2nd is the foreground. (then i'll explode them) Is there a PHP function that let's me validate the input so it's HEX ONLY? I will be db escaping it and intval it too. I've never really made my own bbcode parser function before, but I'm going off of different tutorials to help me create my own style of parsing. I've actually never really used preg_replace much, either. My code is returning an odd error and I have no idea how to fix it. I'm using codeigniter and the error it returns is below: Quote preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 6 This is the code for my function: Code: [Select] function bbParse($string){ $codes = array( '/\[b\](*?)\[\/b\]/' => '<b>\\1</b>', //bold tags '/\[h2\](*?)\[/h2\]/' => '<h2>\\1</h2>', //h2 tags '/\[h3\](*?)[\/h3\]/' => '<h3>\\1</h3>', //h3 tags '/\[quote\](*?)\[\/quote\]/' => '<blockquote>\\1</blockquote>', //quote tags using the template's blockquote tag '/\[img\](*?)\[/img\]/' => '<img src=\'\\1\' alt=\'Image Not Available\'>', //image tags '/\[url\=(*?)\](*?)\[/url\]/' => '<a href=\'\\1\' title=\'\\2\'>\\2</a>', //anchor tags '/\[p\](*?)\[/p\]/' => '<p>\\1</p>' //paragraph tags ); $string = preg_replace(array_keys($codes), array_values($codes), $string); return $string; } Hello. i have created a template in dreamweaver, however when i added php code to a page the position of my bottom div got messed up... it works 100% with just text. I have a container div with other divs in it. inside the container div i have a div named content, and this div is the only div which is editable. in the bottom (outside of the container div) i have a bottom div which is centered with margin:0 auto; this divs position gets totally messed up once i add php code in the content div. http://elevweb.skit.no/0111nema/action_adventure.php here is the link to the page with php with it, as u can see the div with facebook etc in it got a messed up position. When someone buys a "platinum" members, they get several trial gift subscriptions to give to friends and family. What would be the best way to generate unique, random codes that are maybe 8-12 digits long? The workflow I came up with last night does this... In MySQL, I have defined which gift subscriptions are linked to a given Product Versions. (Hint: @gizmola) 😉 Then when someone subscribes, I go to my GIFT_CERTIFICATE_DETAILS table, determine the number of free gift subscriptions, and then my PHP will need to generate that many codes and insert them into my GIFT_SUBSCRIPTION table.
- id - subscription_id - product_id - gift_code
I am thinking that it is better to give people a numeric code? And maybe something 8-12 digits, so it is long enough to be unique across all time, but not so long or complicated that it's a pain in the ass to type into the web form to renew them. Thoughts?
I'm trying to create a part of a script where by the system will generate a sku code and loop through out to see if this exists in the database, if the sku does the script adds one too the code so 001 will turn to 002 then it will keep looping until it finds a SKU that isn't in the database.
However I can get the script to keep generating the new SKU codes but it will only test the first SKU code so the loop will keep going if it exists.
$number=001; if(isset($_POST['submit'])){ $product = $_POST['product']; $brand = $_POST['brand']; $description = $_POST['description']; $contruct=strtoupper($product."-".$brand."-".$description); $number=sprintf("%03s",$number); $check_for=$contruct."-".$number; $query=$cc_db->query("SELECT `sku` FROM `product` WHERE `sku`='".$check_for."'"); $fetch=$cc_db->fetch_object($query); $checking=$cc_db->num_rows($query); while($checking > 0){ echo"$check_for is there : $checking rows : $fetch->sku<br>"; $number=$number+1; $number=sprintf("%03s",$number); $check_for=$contruct."-".$number; } echo $checking; echo $check_for; } |