PHP - Need To Echo A Hash Symbol
Trying to echo a string that contains a hash symbol. Instead of getting a hash symbol, I get %29. The code I am using is pretty basic -->$idx="#" . $idxA;<--, but as stated, when I echo $idx, it comes out as %29. (All of this is part of a form, get, attempting to pass a bookmark to the receiving program.
Thoughts? Similar TutorialsWhat is the & symbol used for I have seen it in function setname(&$name){ $this->name =& $name; } Thanks I have looked on google and can't find it as i don't know what it is called. thanks Hello, Im getting a name from the url, for instance, index.php?name=C.-and-G The "and" is then converted to a & symbol and dashes converted to spaces. This then uses the new name "C. & G" to select a record from mysql. However, it does not recognise the & symbol, the name in mysql is "C. & G" but returns 0 records. Any ideas? Thanks! OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=322426.0 I'm a little confused exactly on how using this } works going to be hard to explain what im having problems with. I'm using JEdit for my editor and I notice if I click on one of these { it will put a box around where it ends there is 4 } at the bottom of the code by them selfs "on their own lines" and 2 in the middle by them selfs "on their own lines how does the code know which ones belong to which { appreicate any help in helping me understand this thanks this code is from a tutor online Code: [Select] <? include_once("connect.php"); ?> <html> <body> <?php if(isset($_POST['Login'])) { if(!preg_match('/^[A-Za-z0-9]{5,20}$/',$_POST['Username'])){ // before we fetch anything from the database we want to see if the user name is in the correct format. echo "Invalid Username."; }else{ $query = "SELECT password,id,login_ip FROM users WHERE name='".mysql_real_escape_string($_POST['Username'])."'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); // Search the database and get the password, id, and login ip that belongs to the name in the username field. if(empty($row['id'])){ // check if the id exist and it isn't blank. echo "Account doesn't exist."; }else{ if(md5($_POST['password']) != $row['password']){ // if the account does exist this is matching the password with the password typed in the password field. notice to read the md5 hash we need to use the md5 function. echo "Your password is incorrect."; }else{ if(empty($row['login_ip'])){ // checks to see if the login ip has an ip already $row['login_ip'] = $_SERVER['REMOTE_ADDR']; }else{ $ip_information = explode("-", $row['login_ip']); // if the ip is different from the ip that is on the database it will store it if (in_array($_SERVER['REMOTE_ADDR'], $ip_information)) { $row['login_ip'] = $row['login_ip']; }else{ $row['login_ip'] = $row['login_ip']."-".$_SERVER['REMOTE_ADDR']; } } $_SESSION['user_id'] = $row['id'];// this line of code is very important. This saves the user id in the php session so we can use it in the game to display information to the user. $result = mysql_query("UPDATE users SET userip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."',login_ip='".mysql_real_escape_string($row['login_ip'])."' WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'") or die(mysql_error()); // to test that the session saves well we are using the sessions id update the database with the ip information we have received. header("Location: Sample.php"); // this header redirects me to the Sample.php i made earlier } } } } ?> <form id="form1" name="form1" method="post" action=""><center> GAME LOGIN <br /> <br /> Username: <input type="text" name="Username" id="Username" /> <br /> <br /> Password: <input type="password" name="password" id="password" /> <br /> <br /> <input type="submit" name="Login" id="Login" value="Login" /> </center> </form> </body> </html> Code: [Select] $query = "LOWER(name)="$tabB"; on my forums, speakwhatsreal.com new message page, let's say somone on my site has the name "$tabB" how do i make the above query work so it selects a username with the $ symbol in it? because with that query it's linked to Code: [Select] $DB->query("SELECT name, id, mgroup, language, email FROM ibf_members WHERE ".$query); $to_member = $DB->fetch_row(); if (empty($to_member['id'])) { $this->send_form(0, $ibforums->lang['err_no_such_member']); return; } pretty much says no results.. lol any help? Hi, I'm looking through some code I have for setting up a rating system. It was a free open source code, which I need to change to work for my own site. I have it working, but I am now just looking through the code to try and understand it, and for the most part, I do. There is one part I am not familiar with, if somebody could help me please? Values involved; $current_rating = total rate value of votes $count = total number of votes cast Problem I have is the @ symbol here $rating=@number_format($current_rating/$count, 1); Does it format it to decimal places or something like that? It's probably something simple I know, but I am a relative newb. Thanks. Easy One - What is the symbol for or? Example: && = and, right? What is 'or'? I am running php 5.3.2 on my local dev and on the server I am running php 5.2.5. In my log files I keep getting deprecated messages like: PHP Deprecated: Assigning the return value of new by reference is deprecated in /Users/xxx/dev/git/xxx/cake/dispatcher.php on line 677 Can I just delete & to get rid of this message or will that hose the script locally and on the server? I believe that php 5+ passes all objects as reference. Thanks Guys, Having a major headache here. I need to send an enquiry using jquery and php. The user can only send an enquiry if they are logged in - so it's a one click process. On the click (which is an <a> tag) the user's data is retrieved from the database and sent to the company they are enquiring about. When the link is clicked, a jquery popup is shown to notify the user that the enquiry has been sent. This all works. However, currently the enquiry is sent when the page loads and this is what I'm having trouble with. Code: [Select] <a href="#e" onclick="openinfobox('Enquiry Sent', 1)" class="enq"></a>What I want to do is say if the URL contains #e, then send the enquiry, otherwise do nothing. I understand that the # portion of the url cannot be referenced by PHP. How on earth can I run php process to say only run this php process if there is a # in the url? Code: [Select] $mystring = "|Signature"; $findme = '|'; $pos = strpos($mystring, $findme); echo $pos; echo's 0 supposed to echo out 1....? why not work thanks How can I enable it to check for Code: [Select] | using strpos? What does it mean Like.. !@file_get_contents('url'); or.. !file_get_contents or @file_get_contents Is a hash array the same thing as an associative array? My PHP books make no reference to this, yet I have seen the term referred to. Thanks. I have a section on my website where the url points to www.example.com/some_page#some_element #some_element is used by javascript to load the element in question into the parent element. However i need pagination done on this loaded element. How should i go about it? would it work? obv i cant use www.example.com/some_page#some_element/page/2. Any tips or advice? Are there any PHP hashes that are extremely secure and that CANNOT be reverse-engineered?
hello i can't figure out how to modify a value from assoc array so with each recursion to add additional string to his: for example i have attribute=""; then call recursive function and i try to modify its value by concatenating "0"; or "1"; on the next loop to add again "0" or "1"; Hi i want to match $ symbol from the string. I am using the following script Code: [Select] $str="ckj"; if(preg_match("/^$/",$str)) { echo "Dollar is found"; } else { echo "Not Found"; } Its not working fine. Can anyone help me out please. So I have a simple query that adds a text record into a MySQL database table. It works great with exception of one thing. I noticed that if I have "&" symbol in my paragraph, the text after that symbol won't be inserted into the table. The text before that symbol will insert fine. It seems to be doing that only with & symbol; other symbols insert and show up fine. can anyone tell me why this is happening? |