473,378 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

single and double quotes problem

pradeepjain
563 512MB
i have values like
alias = Indus International School"In omnia paratus", meaning "Prepared for all challenges"
model = "In omnia paratus", meaning "Prepared for all challenges"

Expand|Select|Wrap|Line Numbers
  1. $myresult .= "<a href=\"Schools/".$_row['alias']."\"><img src=\"/school/schoolpicdisplay.php?p1=".$brand."&p2=".$row['model']." \" width=\"50\" height=\"80\"></img></a>";
when i try to print the alias and model values are not coming . what the work arounf for it . I have used mysql_real_escape_string while inserting to DB. what must be done while printing or after taking out of db.
Feb 24 '10 #1
6 2760
dlite922
1,584 Expert 1GB
use single quotes for html attributes?

Expand|Select|Wrap|Line Numbers
  1.  
  2. $result = "<a href='{$row['alias']}'><img src='/school/schoolpicdisplay.php?p1={$brand}&pd={$row['model']}' width='50' height='80' /></img></a>"
  3.  
  4.  
Dan
Feb 24 '10 #2
pradeepjain
563 512MB
That worked
whats the actual problem in the way i used ?

whts the difference b/w if i use {$model} or ".$model." will it make any difference ?

Now its giving problems for the single quotes thing like

model = Sri Kumaran Children's Home

its not printing completely its printing till Sri Kumaran Children the url looks like

Expand|Select|Wrap|Line Numbers
  1. $myresult .= "<a href='Schools/{$alias}'><img src='/school/schoolpicdisplay.php?p1={$brand}&p2={$model}' width=\"50\" height=\"80\"></img></a>";
Feb 24 '10 #3
pradeepjain
563 512MB
how to handle the single quote problem ?
Mar 3 '10 #4
dlite922
1,584 Expert 1GB
use url_encode().



Dan
Mar 3 '10 #5
pradeepjain
563 512MB
yeah i used rawurlencode . i learnt 2 main thing by this question .

1. to encode the variable when passing through the urls

2. to use mysql_real_escape_string when using the variable in a mysql statement .

any things else important i have left out while handling quotes ?
Mar 4 '10 #6
pradeepjain
563 512MB
i solved tht quotes problem with the rawurlencode . but i am facing another problem. like
the alias has value like $alias = "Sony DSC-TX1/H"
when i am making it an url like

Expand|Select|Wrap|Line Numbers
  1. <a href="<?php echo ucfirst($value).'/'.rawurlencode($row1['alias']); ?>"><?php echo $row1['property1']; echo " ";echo $row1['property2'] ?></a>
its leading to a page not found like
The requested URL /Cameras/SonyDSC-TX1/H was not found on this server.
the / is making a prob .will the rawurlencode take care of slash?

http://122.166.8.199/Cameras/SonyDSC-TX1%2FH
Mar 8 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
2
by: girish | last post by:
In my XML document, some node attributes data contains both single quot and double quote characters, such as <input msg="Hello "World", What's up"/>. The double quotes are in form of escape...
4
by: sankofa | last post by:
hi, i can't seem to be able to escape my single quote properly... is it even possible in javascript? this is a portion of my code.. var DLEWIS="Pastor Lewis"; .... Sermon is a yser-defined...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
4
by: Greg | last post by:
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith">...
3
by: Jason | last post by:
I have several tables with quite a few fields and I'm getting errors when trying to insert records with single quotes in the data like: name = John O'Henry or a city name of O'Fallen So I went...
7
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem...
4
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the...
2
by: Reporter | last post by:
I got the following example from http://www.evolt.org/article/User_Friendly_Forms_in_PHP/20/60144/index.html : echo '<tr><td>First name:</td><td><input type="text" name="first_name"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.