PHP - Can I Delete The & Symbol
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 Similar TutorialsHi all. Here is my scripts which allow user to check multiple rows of data and delete it , but it require select data and click for twice to delete the rows , what should be the error? Code: [Select] <form name="frmSearch" method="post" action="insert-add.php"> <table width="600" border="1"> <tr> <th width="50"> <div align="center">#</div></th> <th width="91"> <div align="center">ID </div></th> <th width="198"> <div align="center">First Name </div></th> <th width="198"> <div align="center">Last Name </div></th> <th width="250"> <div align="center">Mobile Company </div></th> <th width="100"> <div align="center">Cell </div></th> <th width="100"> <div align="center">Workphone </div></th> <th width="100"> <div align="center">Group </div></th> </tr> </form> <? echo "<form name='form1' method='post' action=''>"; while($objResult = mysql_fetch_array($objQuery)) { echo "<tr>"; echo "<td align='center'><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$objResult[addedrec_ID]\"></td>"; echo "<td>$objResult[addedrec_ID] </td>"; echo "<td>$objResult[FirstName]</td>"; echo "<td>$objResult[LastName] </td>"; echo "<td>$objResult[MobileCompany] </td>"; echo "<td>$objResult[Cell] </td>"; echo "<td>$objResult[WorkPhone] </td>"; echo "<td>$objResult[Custgroup] </td>"; echo "</tr>"; } echo "<td colspan='7' align='center'><input name=\"delete\" type=\"submit\" id=\"delete\" value=\"Delete\">"; if (isset($_POST['delete']) && isset($_POST['checkbox'])) // from button name="delete" { $checkbox = ($_POST['checkbox']); //from name="checkbox[]" $countCheck = count($_POST['checkbox']); for($d=0;$d<$countCheck;$d++) { $del_id = $checkbox[$d]; $sql = "DELETE from UserAddedRecord where addedrec_ID = $del_id"; $result2=mysql_query($sql) or trigger_error(mysql_error());;; } if($result2) { $fgmembersite->GetSelfScript(); } else { echo "Error: ".mysql_error(); } } echo "</form>"; Thanks for every reply. <body> <?php include 'sql.php'; $query = "SELECT * FROM validation"; $result = mysqli_query($con , $query); $rows = mysqli_fetch_assoc($result) ; $totals = mysqli_num_rows($result) ; ?> <div id="css"> <form > <table width="80%" border="0" cellpadding="2" cellspacing="2" > <caption><h2>Personal Details of Customers</h2></caption> <tr class="white"> <td bgcolor="#330033"> </td> <td bgcolor="#330033"> Id Number </td> <td bgcolor="#330033"> Full Name </td> <td bgcolor="#330033"> Email Address </td> <td bgcolor="#330033"> Website </td> <td bgcolor="#330033"> Comment </td> <td bgcolor="#330033"> Time </td> </tr> <?php while($rows=mysqli_fetch_assoc($result) { <tr> <input type="raido" name="ID" value="<?php echo $rows['ID']; ?>" /> <td bgcolor="#FFFFCC"><?php echo $rows['ID'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Name'];?> </td> <td bgcolor="#FFFFCC"><?php echo $rows['Email'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Website'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Comment'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Time'];?></td> <td> </td> <td> <a href="delete.php? ID= "$rows[ID]" /"> <input type="submit" name="del" value="Delete" /> </a> <input type="button" name= "edit" value="Edit" /> </td> </tr> }?> </table> </form> </div> </body> Hi,
I wish to find out is there any possible that I can delete some data inside my php website but inside my sql database, the record will still at there?
Thank you.
What 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! This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=322426.0 Easy One - What is the symbol for or? Example: && = and, right? What is 'or'? 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? 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> 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. I'm trying to set it so that it will delete an entire populated directory based upon a value in the database then after finishing that to go back and delete that row in the database. my current code is Code: [Select] <?php $page_title = "Central Valley LLC | Photo Addition" ?> <?php include("header.php"); ?> <?php include("nav.html"); ?> <div id="content"> <form action="delprod.php" method="post" enctype="multipart/form-data"> <label for="which">Choose A Product To Remove:</label> <?php $con = mysql_connect("localhost","phoenixi_cv","centraladmin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("phoenixi_cvproducts", $con); $result = mysql_query("SELECT * FROM Products"); echo "<select name=\"which\">"; while($row = mysql_fetch_array($result)) { echo "<option "; echo "value=\"" . $row['id'] . "\">"; echo $row['Name'] . "</option>"; } echo "</select>"; mysql_close($con); ?> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div><!--#content--> <?php include("footer.html") ?> and the delete script Code: [Select] <?php $con = mysql_connect("localhost","phoenixi_cv","centraladmin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("phoenixi_cvproducts", $con); $result = mysql_query("SELECT id FROM Products WHERE id=$_POST['which']"); $row = mysql_fetch_array($result) chdir('assets'); chdir('images'); $mydir = $row . '/'; $d = dir($mydir); while($entry = $d->read()) { if($entry!="." && $entry!="..") { unlink($_POST['which'] . '/' . $entry); } } rmdir($mydir); $result = mysql_query("DELETE * FROM Producs WHERE id=$_POST['which']"); ?> Thank you in advance for all your help. any easier ways of approaching this will be welcome as well What does it mean Like.. !@file_get_contents('url'); or.. !file_get_contents or @file_get_contents 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? 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? 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? So i'm having some sort of an issue. what i'm trying to do is to get the name from an URL using GET that includes the "&" symbol. I have a link and that link looks like this: name_of_company_&_member. What im trying to do is to get that whole line using Get and echoing on a page. The problem is that the line cuts off after "company_" because it reads the & symbol as something different. Does anyone know how i can be able to retrieve the whole line including everything after the & symbol? i tried using the special character "%26" but i still get the same result. |