/    Sign up×
Community /Pin to ProfileBookmark

i have a problem with ‘ in the end of link

When my link: [url]http://xxxxxxxxxx.com/categories.php?id=99[/url] … the link page is with no problems…but when some one write ‘ afther the link..like this: [url]http://xxxxxxxxxx.com/categories.php?id=99[/url]‘ …. i have a mysql problem:

[code=php]Warning: mysql_fetch_assoc() expects parameter 1 ….[/code]


my check is:

[code=php]if(isset($_GET[‘cat’]))
$arts_id = $_GET[‘cat’];
else…..[/code]

what edits should i do :S ?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@rtretheweyJun 29.2012 — You should always sanitize $_GET and $_POST data with functions like mysql_real_escape_string() to prevent hacking attacks and to avoid problems like the one you're having with random strings. See the php.net page on mysql_real_escape_string().
Copy linkTweet thisAlerts:
@mekhaauthorJun 29.2012 — mm i solved it with

(int) because it is a number...thank u very much man
Copy linkTweet thisAlerts:
@laxmitekJun 30.2012 — nice answer ...............Thank you for your sharing!..........this site is best for developers
Copy linkTweet thisAlerts:
@DasherJun 30.2012 — shouldn't it be

if(isset($_GET['id']))

$arts_id = $_
GET['id'];

else.....

since it is ?id=99 in the url.
×

Success!

Help @mekha spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...