- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 4
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
74 Posted Topics
Hello all, I am working through Beginning Microsoft Visual C# 2008 I was asked to create a console application that multiplies 4 input values. I decided to take all 4 values at once and multiply them. Here is my code: string inputNumbers; string userName; Console.WriteLine("Enter your name:"); userName = Console.ReadLine(); … | |
Re: Taken from http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html $this->load->helper('form'); $options = array( 'small' => 'Small Shirt', 'med' => 'Medium Shirt', 'large' => 'Large Shirt', 'xlarge' => 'Extra Large Shirt', ); echo form_multiselect('shirts[]', $options, $shirts_on_sale); | |
Hello all, I am pretty new to ASP and we are using ASP for logins for our PHP projects, we are using Active Directory LDAP. We can only connect to one container at a time. I have managed to create some code so switch containers but I cannot log in … | |
Re: but the line spaces as you would in phpMyAdmin [CODE]echo nl2br($row_jobdetails['job_description']);[/CODE] | |
Re: With no code examples we cannot possibly begin to help you. Chances are though it is a global server issue. Do you maintain the server yourself or is it hosted? | |
Hello all, I am trying to use more regex but I can't seem to get this to work. The aim is to check inputs for either [url, [link or <a href: [CODE] $islink = false; foreach($_POST as $k => $v){ if((preg_match("/[url|[link|<a href/i", $v)) > 0 ){ $islink = true; } … | |
Hello, I am using a script to process subscriptions on our sites - I can sucessfully get the subscription payment to process, I am having issues processing a cancel IPN request. [CODE] // assign posted variables to local variables $item_name = make_safe($_POST['item_name']); $item_number = make_safe($_POST['item_number']); $payment_status = make_safe($_POST['payment_status']); $payment_amount = … | |
Re: Any variables with the values false/0/NULL/"" are considered to execute false in PHP [CODE] #execcute if $cantitate[$i] is not null if($cantitate[$i]){ //this part of the array is not NULL..... } [/CODE] Would also be fine. | |
Re: If the user does not need to interact with that particular element why have it. You could try the attribute disabled: [CODE] <input type="text" name="name" disabled="disabled" /> [/CODE] | |
Re: Hello to get the time use the date() format: [CODE] //get hour in 24 hour format $hour = date("H"); if($hour >= 06 && $hour < 12){ echo "<img src='morningimage.jpg' />"; }elseif($hour >= 12 && $hour < 18){ echo "<img src='afternoonimage.jpg' />"; } [/CODE] Simply repeat for whatever time you want. | |
Hello, I am using cpanel standard crontab set-up, I have the path to the file correct but the path leads to a password protected directory ie: *php /home/example/public_html/admin/script.php* admin is password protected, how would I allow the crontab access to the script? Thanks in advance. | |
Re: Your if else might not be executing that portion of the code. | |
Hello, Bandwidth on one of our sites was severely messed with on the 28th of this month. The cpanel only tracks daily access logs and didnt archive them(it does now), using aw stats I found our bot traffic to be as follows: Googlebot 145686+43 7.47 GB 28 Jul 2010 - … | |
Re: try [CODE]imagepng($bgim_new,$bgth_file_name,100);[/CODE] the last parameter you pass is image quality - having it 9% of the image quality may cause the black to appear! | |
Re: Might I reccomend you get a javascript error console! I use web dev for firefox - it might display a non standard error which is affecting the IE rendering - failing that maybe a run active objects script? | |
Re: A class is a group of php code that you can use to create a massive set of data you write it the same way you do php code with a few exceptions. [CODE] class First(){ $this->text = "My First class" } //and you call it like so, $firstclass - … | |
Re: If you want to make sure NO caps wahtsoever are user name and password. [CODE] //detect the presence of caps function hasCaps($string) { return(preg_match('/[A-Z]/', $string) > 0 ? true : false); } //don't know how to use functions in if's so will call the functions then make a comparison $usernameCapFree … | |
Hello I was helping a fellow daniwebber and I noticed that I have no idea if it is possible and how the syntax works for it. Any help appreciated. example of how I think it works. [CODE] function retTrue(){ return true; } //code in if if(retTrue()){ //do some php } … | |
Re: The structure is fine - you just need to run a better query. Lookup how to do Joins or querying multiple tables. [B]example[/B] [CODE] $query = "SELECT `p`.`partnumber`, `p`.`description`, `m`.`manufacturer` FROM `parts` `p`, `manufacturers` `m` WHERE `p`.`manufacturer_id` = `m`.`manufacturer_id`" [/CODE] This will set a condition to get both the parts … | |
Re: This reminds me of the southpark "You have 0 friends" episode. I deleted my bebo social network because it was crummy, but I enjoy the control you DO have over facebook and the standard profile that keeps things neat, I dislike the apps that cause other people to post on … | |
Re: The other solution would be to calculate the value using the auto incremented value i.e if your value started at 5 and the id was 7 instead of starting a count wasting db space just get the id and 5. $new_num = $row['id'] + 5; | |
Re: try puttinging @session_start etc before the html. | |
Hello all, I am having some trouble getting my background image to show in FF and IE, I am using firefox web developer add-on and when I click edit css, the background image shows up, when I close the edit css it reverts back to having no background. [URL="http://www.costumeshopfinder.co.uk/test/"]here[/URL] is … ![]() | |
Re: I am a bit confuded as to why you would want to run the query again? The where sponsor = $sponsor should limit the results so the $sponsor you return would be the same as the $sponsor you originally queried for. | |
Re: [CODE] function get_lat_long($postcode) { #change to your local domain i.e. .com $domain = "co.uk"; $url = "http://maps.google." . $domain . "/maps/geo?q=" . urlencode($postcode) . "&output=json&key=".maps_key; $curl = new curl(); $json = $curl->get_page(array("url"=>$url)); $store_data = json_decode(str_replace(""","\"",htmlentities($json))); //Take care of accents $lng = $store_data->Placemark[0]->Point->coordinates[0]; $lat = $store_data->Placemark[0]->Point->coordinates[1]; //Return if($lng && $lat) { … | |
Re: set up a cron job to run everymidnight and do a mysql delete where date < time() if you are storing your dates in timestamp format. If you have cpanel setting up a cron job is quite easy. | |
Re: run the first query (loan) then do this [CODE] if(mysql_num_rows($loanquery1) > 0){ //loans }else{ //books } [/CODE] | |
Re: [QUOTE=SKANK!!!!!;1194985]thanks this seems like the easiest way but where exactly do i put this code? how do incormporate it into my code i posted originally? any help would be appreiciateed.[/QUOTE] [CODE] $dir = opendir ($path); rsort($dir); while (false !== ($file = readdir($dir))) { if (strpos($file, '.png',1)) { echo "$file <br … | |
Re: Also optimise your queries - do you need to run a query inside a loop of another query or can you use JOIN, also do you have primary keys defined. Do you place LIMITS on results so that you only query the records you require? All of these and more … | |
Re: if you have a cpanel web host you should be able to set up a cronjob quite simply in the main menu ![]() | |
Re: Simply Change: [CODE]$results = mysql_query("SELECT Title FROM News ORDER BY Newsid DESC", $db);[/CODE] To: [CODE]$results = mysql_query("SELECT Title FROM News ORDER BY Newsid DESC LIMIT 4", $db);[/CODE] This will tell mysql to limit the query to the first 4 results making the query faster. As for putting in the div … | |
Re: Since every new record is a standalone INSERT query you might be better off counting manually by incrementing a variable? [CODE] $count = 0; while(){ mysql_query("INSERT into.......") or die(mysql_error()); $count++; } [/CODE] | |
Re: This is what you should do: [CODE] //set counter $a = 0; while(){ //check if counter is at start (0) if($a == 0){$results .= '<div class="result"><p>';}//Display at start of a block of 4 results $a++; $results .=''.$result.''; if($a == 4){ //reset counter so it is as start again $ = … | |
Re: last.php is taking $_POST values that to not exist in page3.php thereby overwriting the $_SESSIONS Remove from last.php: [CODE] $_SESSION['value'] = $_POST['value']; $_SESSION['value2'] = $_POST['value2']; $_SESSION['value3'] = $_POST['value3']; [/CODE] And your values should remain in tact. | |
Re: I have been reading that some browsers retain the HTML entities of encoded chars try: [CODE] htmlentities() or htmlspecialchars(). [/CODE] before encoding. [url]http://php.net/manual/en/function.urlencode.php[/url] | |
Re: [CODE] $query = "SELECT * FROM `tablea`, `tableb` WHERE `tablea`.`id` = `tableb`.`aid` AND `tablea`.`id`='".$x."'" ; [/CODE] | |
Re: strip_tags removes php tags also: for javascript etc i use this function: [CODE] #this will strip javascript/html then prepare the script for inserting into database function make_safe($string) { $string = preg_replace('#<!\[CDATA\[.*?\]\]>#s', '', $string); $string = strip_tags($string); $string = htmlentities($string, ENT_NOQUOTES, 'UTF-8', false); $string = stripslashes($string); $string = mysql_real_escape_string($string); return $string; … ![]() | |
![]() | Re: When someone clicks reset you could ajax the deletion of the current db record, or create a new one? |
Re: kinda like this: [CODE] $username = mysql_real_escape_string($_POST['username']); //check if username exists $check_user = mysql_query("SELECT * FROM `users` WHERE username = '".$username."'") or die(mysql_error()); if(mysql_num_rows($check_user) > 0){ //user exists do some code echo "user already exists"; die(); }else{ //username is available } [/CODE] | |
Re: [QUOTE=cwarn23;1130055]What do you mean by "run a muck"? I thought it would be wise.[/QUOTE] It was wise of you to let us know - but not everyone on this site is wise.... or nice! Gratz on nearly cracking it though | |
Re: in what format do you store your check_in & check_out data? If its a timestamp you can make a comparison between them but if is like 1 Jan 2010 you might have some trouble making a comparison. | |
Re: a way to avoid the error would be to check if it exists before unset() - also setting the value to NULL or FALSE. if(isset($_SESSION['credit_total'])){ unset($_SESSION['credit_total']); //$_SESSION['credit_total'] = false; //$_SESSION['credit_total'] = NULL; } | |
Re: The file fields do not get sent via $_POST - they are sent in PHP via $_FILE. there are various tutorials on uploading and changing files names. | |
Re: where ever you print our comment use html_entity_decode(); function i.e. [CODE] echo html_entity_decode($comment); [/CODE] | |
Re: I had this error from referring to http files inside a https location. Apparently this can happen even with images and any external data. | |
Re: I share the same view as cwarn. eventually website design will be as simple as talking to a computer about what you want. Website development has been made easier over the years if you look at the difference between python and php, sure they can both achieve the same things … | |
Re: Php has no problem with HTML tags the problem lies in the header the email is sending out - it is not telling the mail program that the email contains HTML. emhmk1's solution should give you what you are looking for. | |
Re: what is wrong with it? does it enter into the database but the values are not there? Otherwise the die() would give you an errror? | |
Re: You could set the values in sessions or hidden form fields and then process them at the end(this method is inadvised for secure information). | |
Re: Think this is it, just apply your db info to teh $db_text variable; [CODE] $db_text = $db_info[text]; echo substr($db_text, 0, 400); if(strlen($db_text) > 400){ echo "........ Read More"; } [/CODE] |
The End.