Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6050427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:41:13+00:00 2026-05-23T07:41:13+00:00

this is my code function code_exists($code){ $code = mysql_real_escape_string($code); $code_exists = mysql_query(SELECT COUNT(‘url_id’) FROM

  • 0

this is my code

function code_exists($code){
  $code = mysql_real_escape_string($code);
  $code_exists = mysql_query("SELECT COUNT('url_id') FROM 'links' WHERE 'code'='$code'");
  return (mysql_result($code_exists, 0) == 1) ? true : false;
}

it is supposed to check the db to make sure the $code is in it or not
but it keeps giving me the same error

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in 
/home/codyl/public_html/projects/tests/url/func.inc.php on line 16
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:41:14+00:00Added an answer on May 23, 2026 at 7:41 am

    As being said by Shakti you have an error in your sql

    $code_exists = mysql_query("SELECT COUNT(`url_id`) FROM `links` WHERE `code`='$code'");
    

    You need to surround field name with ticks (`) not single quotes. You should also add a statement to chech if the query was run as expected.

    $code_exists = mysql_query("SELECT COUNT(`url_id`) FROM `links` WHERE `code`='$code'") or die('Error in my query: '. mysql_error());
    

    This will kill your program throwing the mysql error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following function: public function already_tweeted($tweet){ return mysql_num_rows(mysql_query(SELECT * FROM `retweeted` WHERE
This code function LoadContent(Id) { alert('Controls/Network/NetworkDetail.aspx?' + rnd() + '&CtlId=' + Id); $.get('Controls/Network/NetworkDetail.aspx?' +
View this code: function testprecision(){ var isNotNumber = parseFloat('1.3').toPrecision(6); alert(typeof isNotNumber); //=> string }
This code always works, even in different browsers: function fooCheck() { alert(internalFoo()); // We
I have this code: dojo.declare(City, null, { constructor : function(cityid, cityinfo){ } }); dojo.declare(TPolyline,
In a webservice I see this code: <WebMethod()> _ Public Function dosomething() As Boolean
I want to convert function object to function. I wrote this code, but it
I see a lot of code like this: function Base() {} function Sub() {}
This is the code I am using to call a function calc in javascript:
I have this piece of code: $(#faq).click(function () { var url = $.get(faq, {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.