Solved

SQL Error - Escape String

Posted on 2011-02-18
4
922 Views
Last Modified: 2012-05-11
I have a form that has been working great. It still works - person fills out the form, selects what pdf's they want. They submit - info stores in database, person gets an email with links to the pdf's and admin gets email saying which pdf's the person asked for.

Recently we have started getting this error
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/visitmit/public_html/moreinfo.php on line 230
 and it repeats for other lines.

That line is mysql_real_escape_string($address, $link); and all other errors are the same line with their corresponding form field.
0
Comment
Question by:katlees
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
mcv22 earned 500 total points
ID: 34930414
Something in the morinfo.php file is causing $link to become null. Try removing the second parameter altogether and see if that works
0
 

Author Comment

by:katlees
ID: 34930465
That fixed it... What would cause it to become null?
0
 
LVL 12

Expert Comment

by:mcv22
ID: 34930495
Can't tell without really looking at what the code does and the entire flow. You can use is_null to check $link and if true, re-initialize the connection. Adding additional debugging will help narrow down where it becomes null.
0
 

Expert Comment

by:fundraisinggold
ID: 34930528
if that link is being returned from a mysql_query, that usually means that the query didn't return any results.  If a query results in 0 records, then mysql_query returns false instead of an actual resource.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL NULL vs Blank 26 36
Select record with the most recent date 14 59
SQL Error - Query 6 26
Correct an issue with a where clause with calculation 2 31
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question