Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Error - Escape String

Posted on 2011-02-18
4
Medium Priority
?
931 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

916 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