Solved

SQL Error - Escape String

Posted on 2011-02-18
4
927 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 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