Solved

SQL Error - Escape String

Posted on 2011-02-18
4
919 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now