Hi all,
I am working on a project.
On the php page, I am linking to a list of ip addresses which are already in my database.
The url will be something like
domain.com/view.php?ip=61.167.34.179
In view.php
I have the following sql
$connect = @mysql_query($sql,$connection) or die(mysql_error());
$sql = "SELECT * FROM 'profile' WHERE ip = $_Get[ip]";
while ($row = mysql_fetch_array($result)) {
$record = $row['record'];
$cat = $row['cat'];
$sub = $row['subcat'];
$creator = $row['creator'];
$mtitle = $row['maintitle'];
$murl = $row['mainurl'];
$dtitle = $row['directtitle'];
$durl = $row['directurl'];
$descript = $row['descript'];
$requires = $row['requires'];
$tech = $row['techniques'];
$thumb = $row['thumb'];
$large = $row['large'];
$ip = $row['ip'];
if ($thumb !="") {
$img = "<a href=\"$large\" target=_blank><img src=\"$thumb\" width=113 height=85 border=0><br>
Click to Enlarge</a>";
}
else {
$img = "<img src=\"http://domain.com/none.jpg\" width=113 height=85><br>";
}
$result= the information which I will echo in the body, just cutting this off here so as not to take up too much space on dinaweb
Whenever I go to the page, view.php with the generated link on the prior page, I get an error "Query was empty".
As a trouble shoot, I echo the $_GET[ip] and the correct ip does show up.
I then, logged into my server, and went to my database and ran the same query in the database, but, I changed the $_GET[ip] to the actual ip address. I was posed with an error, until I realized that I should put a single quote mark around the ip address.
So, I figured that, perhaps this was my issue to begin with.
Now, I have tried several things with my php page, to get the single quote to pass through to the sql statement, but, it just doesn't do it.
Can anyone help me with this? Is there something wrong with the fact that I have "TEXT" as the field type in the database? also the Collation is set to latin1_swedish_ci and I don't understand what to do with collation.
Any help?
thanks so much
Sage